Cannot assign value of Type User to type User

寵の児 提交于 2020-03-05 03:13:06

问题


last time my code worked fine as other member suggested. And somehow today, the error appear again. I keep checking but can't figure out how.

class AuthFirebase: NSObject {
    //This is instance of FIRDatabase to read and write data from Firebase database
    static let dataBase = Database.database().reference()
    static var currentUserID:String = ""
    static var currentUser: User? = nil
    //Create Function to Log In
    static func LogIn(email:String, password:String, completion: @escaping(_ success: Bool ) ->
        Void) {
        Auth.auth().signIn (withEmail: email, password: password, completion:{ (AuthDataResult,error) in
            if let error = error {
                print(error.localizedDescription)
                completion(false)
            }
            else {
                if let user = AuthDataResult?.user {
                currentUser = user
                currentUserID = user.uid
                completion(true) }
            }



    }
)

}
}

来源:https://stackoverflow.com/questions/60143831/cannot-assign-value-of-type-user-to-type-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!