Skip to content

Instantly share code, notes, and snippets.

@yusufozgul
Created June 12, 2019 14:35
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 yusufozgul/e1b7de6b9095265568fac3dc2b5bddd5 to your computer and use it in GitHub Desktop.
Save yusufozgul/e1b7de6b9095265568fac3dc2b5bddd5 to your computer and use it in GitHub Desktop.
Sign in with Apple
extension ViewController: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding
{
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)
{
guard let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential else { return }
print("USER: \(appleIDCredential.user)")
print("EMAIL: \(appleIDCredential.email!)")
print("FULL NAME: \(appleIDCredential.fullName!)")
}
func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor
{
return self.view.window!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment