How can I solve it this way?
Syntax seems correct according to documentation:
Auth.auth().createUser(withEmail: email, password: password) { authResult, error in }
But you do not give any context:
- version of Xcode
- version of Firebase
Did you import ?
import FirebaseAuth
You could try removing parenthesis around authResult, error, but that should not make a difference.