Skip to content

Instantly share code, notes, and snippets.

@BalajiMalliswamy
Last active May 30, 2018 07:27
Show Gist options
  • Save BalajiMalliswamy/b249a90ddc55b810382c93a5027740af to your computer and use it in GitHub Desktop.
Save BalajiMalliswamy/b249a90ddc55b810382c93a5027740af to your computer and use it in GitHub Desktop.
Exploring UIAlertController in swift
/**
Simple Action Sheet
- Show action sheet with title and alert message and actions
*/
func showSimpleActionSheet(controller: UIViewController) {
let alert = UIAlertController(title: "Title", message: "Please Select an Option", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Approve", style: .default, handler: { (_) in
print("User click Approve button")
}))
alert.addAction(UIAlertAction(title: "Edit", style: .default, handler: { (_) in
print("User click Edit button")
}))
alert.addAction(UIAlertAction(title: "Delete", style: .destructive, handler: { (_) in
print("User click Delete button")
}))
alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: { (_) in
print("User click Dismiss button")
}))
self.present(alert, animated: true, completion: {
print("completion block")
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment