Creating new user with firebase in Swift

后端 未结 4 1068
余生分开走
余生分开走 2021-01-15 17:36

I am new to Firebase and have been trying to implement a \"Sign Up\" page for my app. Currently, I am only using the email feature, just to test things out. I am able to cre

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 18:09

    Creating user in Firebase is very easy, just add firebase to your project using cocoa pods and then create a signup screen. You need email and password. Now first import Firebase

    import Firebase
    

    Then inside on viewDidLoad() method configure firebase

    FIRApp.configure()
    

    Now get email and password from textfields and use the following code for registration.

    FIRAuth.auth()?.createUserWithEmail(email!, password: password!, completion: { (user: FIRUser?, error) in
       if error == nil {
           //registration successful
       }else{
           //registration failure
       }
    })
    

    Thats it.

    Source: Firebase Swift Tutorial

提交回复
热议问题