Guest User

Untitled

a guest
Jul 15th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. static func showEverywhere(_ alert: UIAlertController) {
  2. if !exist() {
  3. let alertWindow = UIWindow(frame: UIScreen.main.bounds)
  4. alertWindow.rootViewController = UIViewController()
  5. alertWindow.windowLevel = UIWindowLevelAlert + 1;
  6. alertWindow.makeKeyAndVisible()
  7. alertWindow.rootViewController?.present(alert, animated: true, completion: nil)
  8. }
  9. }
  10.  
  11. static func exist() -> Bool {
  12. if let _ = UIApplication.shared.keyWindow?.rootViewController?.presentedViewController as? UIAlertController {
  13. return true
  14. }
  15.  
  16. return false
  17. }
Add Comment
Please, Sign In to add comment