Skip to content

Instantly share code, notes, and snippets.

@BradB132
Created May 31, 2015 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BradB132/b1bc810c3c8b5380adfb to your computer and use it in GitHub Desktop.
Save BradB132/b1bc810c3c8b5380adfb to your computer and use it in GitHub Desktop.
FirstAppInSwift-10
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .Alert /* or .ActionSheet*/)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: { (action:UIAlertAction!) in
//this block runs when 'OK' is tapped
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: { (action:UIAlertAction!) in
//this block runs when 'Cancel' is tapped
}))
//present this controller just like any other
self.presentViewController(alert, animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment