Created
February 10, 2017 08:36
-
-
Save cjndubisi/a08464e71ebee53dc99fe021f866c90d to your computer and use it in GitHub Desktop.
Nested Callbacks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func createProfile(completionHandler: @escaping (Any?, Error?) -> Void) { | |
| let params = self.params() | |
| // sign up | |
| auth.signup(with: params) { error in | |
| guard error == nil else { completionHandler(nil, error); return } | |
| // log in | |
| self.auth.signIn(email: email, password: password, completion: { (error) in | |
| guard error == nil else { completionHandler(nil, error); return } | |
| // get users profile | |
| self.auth.user(with: params, completion: { (error, individual) in | |
| guard error == nil else { completionHandler(nil, error); return } | |
| completionHandler(individual, nil) | |
| }) | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment