Created
          April 10, 2019 15:27 
        
      - 
      
- 
        Save fahied/4e0744096d99bf09953772cf64704b98 to your computer and use it in GitHub Desktop. 
    UIWindow Alert
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func showAlert(message: String) { | |
| let alert = UIAlertController(title: "Link", message: message, preferredStyle: .alert) | |
| alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in | |
| switch action.style{ | |
| case .default: | |
| print("default") | |
| case .cancel: | |
| print("cancel") | |
| case .destructive: | |
| print("destructive") | |
| }})) | |
| let topWindow = UIWindow(frame: UIScreen.main.bounds) | |
| topWindow.rootViewController = UIViewController() | |
| topWindow.windowLevel = UIWindow.Level.alert + 1 | |
| topWindow.makeKeyAndVisible() | |
| topWindow.rootViewController?.present(alert, animated: true, completion: nil) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment