If I present an AlertController using self.present(alert, animated: true, completion: nil) then I can also check if that alert is onscreen using if self.presentedViewController == nil
When it is an alert controller presented by the system, self.presentedViewController is still nil even though there is an alert view on the screen.
Is there any way I can check for whether this alert is onscreen?
Look to see whether the app’s keyWindow is your window. If it isn’t, something is being presented in front of your app by the system.
Also look at your app’s state. If it isn’t active, it has been deactivated by something appearing front of it.
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