I have a helper to show my alerts
import UIKit
class AlertDialog {
class func showAlert(_ title: String, message: String, viewController: UIViewController) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let OKAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(OKAction)
let cancelAction = UIAlertAction(title: "Cancel", style: .default, handler: nil)
alertController.addAction(cancelAction)
viewController.present(alertController, animated: true, completion: nil)
}
}
How can I manage the actions in my View Controllers?
I am calling the func like this;
AlertDialog.showAlert("Ok", message: "Some Message", viewController: self)
I need to get the handler option. What do I change the "handler: nil" to?