Last active
March 15, 2023 12:30
-
-
Save BalajiMalliswamy/302661ccbc16967b269d54d91c38fcbb to your computer and use it in GitHub Desktop.
Exploring UIAlertController in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Simple Alert | |
- Show alert with title and alert message and basic two actions | |
*/ | |
func showSimpleAlert() { | |
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.default, | |
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