Darin Wilson Darin Wilson - 1 month ago 27
Swift Question

Having problems implementing Create User with FIRAuth

I've ran into this issue and have been trying to solve it for a few days now and it seems everything I try it creates more errors. I'm having problems creating a user with this function use FIRAuth and its telling me to add in a ; right before in, but it doesn't fix the problem.
Picture of Errors

func handleRegistration() {
guard let email = emailTextField.text, let password = passTextField.text
else {
print("Form is not Valid")
return
}



FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: FIRUser?, error) in

if error != nil {
print("Error")
return
}

print("Login Successful")
}

Answer

Try this :-

FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: {(user, error) in

     if error != nil {
        print("Error")
        return
    }else{
        print("Login Successful")
        return 
   }
})
Comments