Skip to content

Instantly share code, notes, and snippets.

@MaatheusGois
Last active March 21, 2020 04:00
Show Gist options
  • Save MaatheusGois/0a4b0bd27a2cb04f442baa24cf6c3db3 to your computer and use it in GitHub Desktop.
Save MaatheusGois/0a4b0bd27a2cb04f442baa24cf6c3db3 to your computer and use it in GitHub Desktop.
extension ViewController: ASAuthorizationControllerDelegate {
//1
func authorizationController(controller: ASAuthorizationController,
didCompleteWithAuthorization
authorization: ASAuthorization) {
//1.1
if let appleIDCredential = authorization.credential as?
ASAuthorizationAppleIDCredential {
let userIdentifier = appleIDCredential.user
let fullName = appleIDCredential.fullName
let email = appleIDCredential.email
print("User id is \(userIdentifier) \n
Full Name is \(String(describing: fullName)) \n
Email id is \(String(describing: email))")
}
}
//2
func authorizationController(controller: ASAuthorizationController,
didCompleteWithError error: Error) {
print(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment