Creating new user with firebase in Swift

后端 未结 4 1070
余生分开走
余生分开走 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:23

    Example of how to create users:

        Auth.auth().createUser(withEmail: email, password: password, completion: { (result, error) -> Void in
            if (error == nil) {
                    UserDefaults.standardUserDefaults().setValue(result.uid, forKey: "uid")
    
                    print("Account created :)")
    
                    let userDict = ["Name": name!, "Major": major!, "Email": email!]
    
                    let uid = result!.uid
    
                    self.dismissViewControllerAnimated(true, completion: nil)
            }
    
            else{
                    print(error)
            }
        })
    

    Hope this helps.

提交回复
热议问题