I want to show an alert, but UIAlertView isn't working in swift.
How can I do this?
This is how I do it in objective-c but when I try to convert it to swift code it doesn't work.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message"
You should use
UIAlertView is deprecated.
You can show an alert with this code:
var alert = UIAlertController(title: "Alert", message: "test", preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil)) self.presentViewController(alert, animated: true, completion: nil)