Skip to content

Instantly share code, notes, and snippets.

@davut
Created September 27, 2018 18:42
Show Gist options
  • Save davut/9e3931e0c8dae550ff15800ada62da6f to your computer and use it in GitHub Desktop.
Save davut/9e3931e0c8dae550ff15800ada62da6f to your computer and use it in GitHub Desktop.
extension UIViewController {
func showAlert(withTitle title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let action = UIAlertAction(title: actionTitle, style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
func showHeyAlert() {
showAlert(withTitle: "Hey", message: "HeyHey", actionTitle: "OK")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment