Skip to content

Instantly share code, notes, and snippets.

@MartinP7r
Last active June 24, 2018 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinP7r/755e5b368a3e7ef594da4c1016e96c7d to your computer and use it in GitHub Desktop.
Save MartinP7r/755e5b368a3e7ef594da4c1016e96c7d to your computer and use it in GitHub Desktop.
medium_post_03
class Authenticator {
let userDataService = UserDataService()
func auth(using signInService: SignInService,
_ completion: @escaping (_ user: User?) -> Void) {
signInService.signIn { token in
userDataService.load(forToken: token) { user in
completion(user) // note: error handling omitted for brevity
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment