Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static func showEverywhere(_ alert: UIAlertController) {
- if !exist() {
- let alertWindow = UIWindow(frame: UIScreen.main.bounds)
- alertWindow.rootViewController = UIViewController()
- alertWindow.windowLevel = UIWindowLevelAlert + 1;
- alertWindow.makeKeyAndVisible()
- alertWindow.rootViewController?.present(alert, animated: true, completion: nil)
- }
- }
- static func exist() -> Bool {
- if let _ = UIApplication.shared.keyWindow?.rootViewController?.presentedViewController as? UIAlertController {
- return true
- }
- return false
- }
Add Comment
Please, Sign In to add comment