I am creating an ASWebAuthenticationSession
session and in the completion handler I have cleanup tasks for when the user cancel's the login:
let session = ASWebAuthenticationSession(url: url, callbackURLScheme: redirectURI) { (callbackURL: URL?, error: Error?) in
if case .ASWebAuthenticationSessionError.canceledLogin? = error {
// clean up tasks
}
// proceed...
}
In iOS 13+, the user is able to swipe down to dismiss, but the entire completion handler is not fired at all in this scenario. I do not want to disable this gesture by enabling isModalInPresentation.
Is there a way to make the ASWebAuthenticationSessionError.canceledLogin fire for this case, or how can I detect the user swiping down to cancel the ASWebAuthenticationSession
session?
Frustrating how difficult this is, but I was able to detect the dismissal by overriding the window's
willRemoveSubview()
.