Reputation: 25
I'm starting to learning Swift and I'm currently following some tutorials and I'm stuck here with this problem.
After I declare this:
typealias LoginHandler = (_ msg: String) -› Void;
I got this error:
Tuple element cannot have two labels
I need this LoginHandler to have a message and retrieve void so I can use it in my login function to handle my Firebase errors.
typealias LoginHandler = (_ msg: String) -› Void;
class AuthProvider {
private static let _instance = AuthProvider();
static var Instance: AuthProvider {
return _instance;
}
func login(withEmail: String, password: String, loginHandler: LoginHandler?){
Auth.auth().signIn(withEmail: withEmail, password: password, completion: {(user, error) in
if error != nil {
} else {
}
});
}
}
So I have been trying different things but none of them have worked.
Upvotes: 0
Views: 673
Reputation: 536057
This is not a correct function type declaration:
typealias LoginHandler = (_ msg: String) -› Void
You are using the wrong "greater than" symbol (unicode hex 203A).
Your code should look like this:
typealias LoginHandler = (_ msg: String) -> Void
Notice that difference in the second character making up the "arrow operator" (unicode hex 003E).
Upvotes: 3
Reputation: 2010
You only need to add a space after ">"
typealias LoginHandler = (_ msg: String) -> Void
Upvotes: 1