I just upgraded the pod file on my Xcode project for Firebase and it displayed a bunch of errors. When signing up a user I get the error Cannot convert value type "User?" to expected argument type "User!"
I'm not sure what the problem is. I tried changing some of the optional values to get it working, but I do not seem to understand well what the issue is.
Here's the function where I have the error:
The code has been modified with the solution to my issue
import Firebase
// Sign Up Function
func signUp(username: String, name: String, email: String, password: String){
Auth.auth().createUser(withEmail: email, password: password, completion: { (user, error) in
if error == nil {
self.setUserInfo(user: user, username: username, name: name, email: email, password: password)
}
else{
print(error?.localizedDescription as Any)
}
})
}
// Set the user info to Firebase storage. username, and password
private func setUserInfo(user: Firebase.User!, username: String, name: String, email: String, password: String){
if error == nil {
self.saveUserInfo(user: user, username: username, name: name, password: password)
}
else{
print(error?.localizedDescription as Any)
}
}
EDIT:
As user ryanwils mentioned, wherever I use FIRUserneeded to be replaced with Firebase.User
Here's a link to the Migration guide that explained this a little bit further: https://firebase.google.com/docs/reference/ios/naming-migration-guide
Note that the code has been updated so no errors are given as of the day of this edit