Skip to content

Instantly share code, notes, and snippets.

@BalajiMalliswamy
Last active May 30, 2018 07:23
Show Gist options
  • Save BalajiMalliswamy/6390ccff4aa96d402de93bf85e7af603 to your computer and use it in GitHub Desktop.
Save BalajiMalliswamy/6390ccff4aa96d402de93bf85e7af603 to your computer and use it in GitHub Desktop.
Exploring UIAlertController in swift
/**
Simple Alert with more than 2 buttons
*/
func showAlertWithThreeButton() {
let alert = UIAlertController(title: "Alert", message: "Alert with more than 2 buttons", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Default", style: .default, handler: { (_) in
print("You've pressed default")
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (_) in
print("You've pressed cancel")
}))
alert.addAction(UIAlertAction(title: "Destructive", style: .destructive, handler: { (_) in
print("You've pressed the 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