Skip to content

Instantly share code, notes, and snippets.

@BalajiMalliswamy
Last active May 30, 2018 07:26
Show Gist options
  • Save BalajiMalliswamy/99ef95849724c1415930042237392a07 to your computer and use it in GitHub Desktop.
Save BalajiMalliswamy/99ef95849724c1415930042237392a07 to your computer and use it in GitHub Desktop.
Exploring UIAlertController in swift
/**
Simple Alert with Distructive button
*/
func showAlertWithDistructiveButton() {
let alert = UIAlertController(title: "Sign out?", message: "You can always access your content by signing back in", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.default, handler: { _ in
//Cancel Action
}))
alert.addAction(UIAlertAction(title: "Sign out",
style: UIAlertActionStyle.destructive,
handler: {(_: UIAlertAction!) in
//Sign out action
}))
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