Question : ui alert swift yes no
Answered by : defeated-dormouse-g5ki2n1k57q5
let refreshAlert = UIAlertController(title: "Refresh", message: "All data will be lost.", preferredStyle: UIAlertControllerStyle.alert)
refreshAlert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action: UIAlertAction!) in print("Handle Ok logic here")
}))
refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in print("Handle Cancel Logic here")
}))
present(refreshAlert, animated: true, completion: nil)
Source : https://stackoverflow.com/questions/25511945/swift-alert-view-with-ok-and-cancel-which-button-tapped | Last Update : Tue, 05 May 20