Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import UIKit
extension UIViewController {
func getForegroundAlertController() -> UIAlertController? {
var viewController = UIApplication.sharedApplication().keyWindow?.rootViewController
while let controller = viewController?.presentedViewController {
if controller is UIAlertController {
viewController = controller
break
}
}
guard let alert = viewController as? UIAlertController else {
return nil
}
return alert
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.