I have coded a service use to sign-in users:
func login(email: String, password: String) -> Bool {
var userIsConnected = false
Auth.auth().signIn(withEmail: email, password: password) { (user, error) in
if error != nil {
print(type(of: error)) // Print 'NSError'
print(error!)
}
else {
userIsConnected = true
}
}
return userIsConnected
}
When I print the error I get:
Error Domain=FIRAuthErrorDomain Code=17008 "The email address is badly formatted." UserInfo={NSLocalizedDescription=The email address is badly formatted., error_name=ERROR_INVALID_EMAIL}
How can I get the Code value (17008) to be able to do some custom behaviour ?
Note: In a previous version of FirebaseAuth we can simply do error.code but in the last version we can't.