|
class Basis {
static func showOKDialog(parent:UIViewController, _title title:String, _message message:String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) // alert actionSheet
let okAction = UIAlertAction(title: "Ok", style: .default) { (_) in
// self.ok()
}
alertController.addAction(okAction)
parent.present(alertController, animated: true, completion: nil)
} // showOKDialog
static func showNoYesDialog(parent:UIViewController,_title title:String, _message message:String, _yesFunc yesFunction : @escaping()->Void, _noFunc noFunction : @escaping()->Void) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let noAction = UIAlertAction(title: "No", style: .default) { (_) in
noFunction()
}
let yesAction = UIAlertAction(title: "Yes", style: .destructive) { (_) in
yesFunction()
}
alertController.addAction(noAction)
alertController.addAction(yesAction)
parent.present(alertController, animated: true, completion: nil)
} // showYesNoDialog
static func showYesNoDialog(parent:UIViewController,_title title:String, _message message:String, _yesFunc yesFunction : @escaping()->Void, _noFunc noFunction : @escaping()->Void) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let confirmAction = UIAlertAction(title: "Yes", style: .default) { (_) in
yesFunction()
}
let cancelAction = UIAlertAction(title: "No", style: .destructive) { (_) in
noFunction()
}
alertController.addAction(confirmAction)
alertController.addAction(cancelAction)
parent.present(alertController, animated: true, completion: nil)
} // showYesNoDialog
static func showYesNoCancelDialog(parent:UIViewController,_title title:String, _message message:String, _yesFunc yesFunction : @escaping()->Void, _noFunc noFunction : @escaping()->Void, _cancelFunc cancelFunction : @escaping()->Void) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let yesAction = UIAlertAction(title: "Yes", style: .default) { (_) in
yesFunction()
}
let noAction = UIAlertAction(title: "No", style: .destructive) { (_) in
noFunction()
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (_) in
cancelFunction()
}
alertController.addAction(yesAction)
alertController.addAction(noAction)
alertController.addAction(cancelAction)
parent.present(alertController, animated: true, completion: nil)
} // showYesNoCancelDialog
}
|
|