Skip to content

Instantly share code, notes, and snippets.

@growvv
Forked from BalajiMalliswamy/SimpleAlert.swift
Created November 22, 2020 04:31
Show Gist options
  • Save growvv/8c2b65e8f88de4c478757ffc339bbfb1 to your computer and use it in GitHub Desktop.
Save growvv/8c2b65e8f88de4c478757ffc339bbfb1 to your computer and use it in GitHub Desktop.
Exploring UIAlertController in Swift
/**
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)
}
@growvv
Copy link
Author

growvv commented Nov 22, 2020

UIAlertController.Style.alert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment