var alert = UIAlertController(title: "Hello!", message: "Thanks for stopping by!!!", preferredStyle: UIAlertController.Style.alert) let alertOKAction=UIAlertAction(title:"OK", style: UIAlertAction.Style.default,handler: { action in print("OK Button Pressed") }) let alertCancelAction=UIAlertAction(title:"Cancel", style: UIAlertAction.Style.destructive,handler: { action in print("Cancel Button Pressed") }) alert.addAction(alertOKAction) alert.addAction(alertCancelAction) self.present(alert, animated: true, completion: nil)
Read More