I want to show alertview in my controller classes. So i have created a common function to show alert & respond to it's action buttons.
In Commonfunctions.swift 
i have created one function like below
 func showActionAlertView(title:String,message:String,vc:UIViewController) -> Void {
let Alert = UIAlertController(title: "Warning", message:  NSLocalizedString("Alert_Delete", comment: ""), preferredStyle: UIAlertControllerStyle.alert)
Alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { (action: UIAlertAction!) in
  Constant.commonfunction.showLoader(withMessage: "Loading")
}))
Alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in
  print("Handle Cancel Logic here")
}))
vc.present(Alert, animated: true, completion: nil)
}
and created a protocol in Commonfunctions.swift.
protocol alertDelegate
{
  func okAction(controller:UIViewController)
  func cancelAction(controller:UIViewController)
}
In controller class i have added this
class
MyController:UIViewController,UITableViewDelegate,UITableViewDataSource,CLLocationManagerDelegate,alertDelegate
{
  var delegate:alertDelegate! = nil
}
call back functions goes here
 func okAction(controller: UIViewController) {
    print("Ok Action")
  }
  func cancelAction(controller: UIViewController) {
    print("Cncel Action")
  }
and i am showing the alert below like this
  Constant.commonfunction.showActionAlertView(title: NSLocalizedString("Success", comment: ""), message: NSLocalizedString("CreateProperty_Alert_created", comment: ""), vc: self)
I am not able to call okAction & cancelAction methods. Tell how to implement call back.
 
     
     
     
    