Last active
July 8, 2016 00:31
-
-
Save rajohns08/de6a5c66ed160bb2caec to your computer and use it in GitHub Desktop.
iOS / Swift - Helper class for showing a simple dialog
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 | |
class OkAlert { | |
class func show(inViewController viewController: UIViewController, title: String, message: String) { | |
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert) | |
alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)) | |
viewController.presentViewController(alert, animated: true, completion: nil) | |
} | |
class func showUnknownErrorAlert(inViewController viewController: UIViewController) { | |
OkAlert.show(inViewController: viewController, title: "Unknown Error", message: "An Unknown error occurred") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment