Skip to content

Instantly share code, notes, and snippets.

@geosava
Forked from seyhunak/uialertcontroller.swift
Last active August 29, 2015 14:23
Show Gist options
  • Save geosava/f9b6cee41b1ef7c128cb to your computer and use it in GitHub Desktop.
Save geosava/f9b6cee41b1ef7c128cb to your computer and use it in GitHub Desktop.
// Declaring UIAlertController
var alert = UIAlertController(title: "Welcome!", message: "You logged in!", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Continue", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
// Handling UIAlertController Actions
alert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { action in
switch action.style{
case .Default:
println("default")
break
case .Cancel:
println("cancel")
break
case .Destructive:
println("destructive")
break
}
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment