i looked at solutions for firebase authentication online and on here. I haven't found a solution to implement a listener for firebase authentication.
Older solutions use the following code for a listener. i used it and gives an error.
- cannot assign the value of type 'User.Type' to the User.
//Below is the following code i used for the listener
func listen() {
handle = Auth.auth().addStateDidChangeListener({ (auth, user) in
if let user = user {
self.session = User
} else {
self.session = nil
}
})
}
//this is the user model below
struct User {
var uid: String
var email: String
}