Skip to content

Instantly share code, notes, and snippets.

@itirokob
Created November 4, 2020 14:24
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 itirokob/fa38bb59116fe56d82dec09e0bbda4a8 to your computer and use it in GitHub Desktop.
Save itirokob/fa38bb59116fe56d82dec09e0bbda4a8 to your computer and use it in GitHub Desktop.
Implementing SWA delegates in specific class
public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
// Call didFetch(authorizationCredential:)
}
//To test didFetch(authorizationCredential:), mock ASAuthorizationAppleIDCredentialProtocol and
//assert that your delegate is being called properly
func didFetch(authorizationCredential: ASAuthorizationAppleIDCredentialProtocol) {
let credential = mapCredential(from: authorizationCredential)
delegate?.didCompleteWith(credential: credential)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment