Skip to content

Instantly share code, notes, and snippets.

@jasonhilimire
jasonhilimire / UIAlertController
Last active December 11, 2017 23:39
[UIAlertController] How to show An Alert Controller #swift
let alertController = UIAlertController(title: "Warning!", message: "This will do some crazy stuff! This cannot be undone", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { action in
print("Cancel button pressed")
}
alertController.addAction(cancelAction)
// maybe some stuff
let deleteAction = UIAlertAction(title: "Delete", style: .destructive) { action in
// .destructive = RED text, .default = blue text
// some stuff