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?
I had the same problem. I found out, that the ViewController from which the ASWebAuthenticationSession
is presented from, gets a call of its dismiss()
function if the user swiped down the ASWebAuthenticationSession
screen. So if you want to react on this user interaction, this is the only place where this can be done as far as I know.
Find out, from which ViewController the ASWebAuthenticationSession
is presented from and the override its dismiss()
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With