Last active
August 31, 2016 08:17
-
-
Save bittz/fa09c9602124cde84f3787cf027cce89 to your computer and use it in GitHub Desktop.
Present basic alert with UIViewController.
This file contains 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
import UIKit | |
extension UIViewController { | |
func presentAlert(message: String) { | |
if presentedViewController == nil { | |
let alertController = UIAlertController(title: nil, message: message, preferredStyle: .Alert) | |
let alertAction = UIAlertAction(title: "OK", style: .Default, handler: nil) | |
alertController.addAction(alertAction) | |
presentViewController(alertController, animated: true, completion: nil) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment