Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func handleRegister(email:String, password:String, username:String) {
- //Create User
- FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: { (user, err) in
- if err != nil {
- print(err!.localizedDescription)
- return
- }
- //Success! User Created!
- if let userID = user?.uid {
- //Create User Profile
- let databaseRef = FIRDatabase.database().reference()
- let usersRef = databaseRef.child("Users").child(userID)
- let usernameValue = ["username":username]
- usersRef.updateChildValues(usernameValue, withCompletionBlock: { (err, ref) in
- if err != nil {
- print(err!.localizedDescription)
- return
- }
- //Profile created and updated!
- })
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement