Skip to content

Instantly share code, notes, and snippets.

@davut
Created September 27, 2018 18:38
Show Gist options
  • Save davut/9aabad5c77ab68796f344c1c0ea20a80 to your computer and use it in GitHub Desktop.
Save davut/9aabad5c77ab68796f344c1c0ea20a80 to your computer and use it in GitHub Desktop.
class MyAlertController {
func showAlert(on vc: UIViewController, withTitle title: String, message: String, actionTitle: String) {
let alertController = UIAlertController(..)
let action = UIAlertAction(...)
alertController.addAction(action)
vc.present(alertController, animated: true, completion: nil)
}
func showErrorMessage(on vc: UIViewController) {
showAlert(on: vc, withTitle: "ERROR!", message: "Something went wrong", actionTitle: "OK")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment