Skip to content

Instantly share code, notes, and snippets.

@vasilevkin
Last active November 20, 2018 06:35
Show Gist options
  • Save vasilevkin/f58ca7a101a69f29b029c158606a64f0 to your computer and use it in GitHub Desktop.
Save vasilevkin/f58ca7a101a69f29b029c158606a64f0 to your computer and use it in GitHub Desktop.
Just a boiler plate code to display simple alert in Swift.
let alert = UIAlertController(title: "Simple Title",
message: "Alert message",
preferredStyle: .alert)
let okAction = UIAlertAction(title: "Close", style: .default)
alert.addAction(okAction)
DispatchQueue.main.async {
UIApplication.topViewController()?.present(alert, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment