Skip to content

Instantly share code, notes, and snippets.

@nishabe
Created August 12, 2018 18:29
Show Gist options
  • Save nishabe/f9d8c0095067047325ad7ba1e3ee1def to your computer and use it in GitHub Desktop.
Save nishabe/f9d8c0095067047325ad7ba1e3ee1def to your computer and use it in GitHub Desktop.
SWIFT: AlertViewController
let alert = UIAlertController(title: "Alert Title", message: "Alert Message", preferredStyle: UIAlertControllerStyle.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")
}}))
self.present(alert, animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment