title: Common function for alert view?
body: <p>I want to show alertview in my controller classes. So i have created a common function to show alert &amp; respond to it's action buttons.</p>
  
  <p>In <code>Commonfunctions.swift</code> </p>
  
  <p>i have created one <strong>function</strong> like below </p>
  
  <pre><code> func showActionAlertView(title:String,message:String,vc:UIViewController) -&gt; 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)
  }
  </code></pre>
  
  <p>and created a protocol in <code>Commonfunctions.swift</code>.</p>
  
  <pre><code>protocol alertDelegate
  {
    func okAction(controller:UIViewController)
    func cancelAction(controller:UIViewController)
  }
  </code></pre>
  
  <p>In controller class i have added this </p>
  
  <p>class </p>
  
  <pre><code>MyController:UIViewController,UITableViewDelegate,UITableViewDataSource,CLLocationManagerDelegate,alertDelegate
  {
    var delegate:alertDelegate! = nil
  }
  </code></pre>
  
  <p>call back functions goes here</p>
  
  <pre><code> func okAction(controller: UIViewController) {
  
      print("Ok Action")
  
    }
    func cancelAction(controller: UIViewController) {
  
      print("Cncel Action")
  
    }
  </code></pre>
  
  <p>and i am showing the alert below like this </p>
  
  <pre><code>  Constant.commonfunction.showActionAlertView(title: NSLocalizedString("Success", comment: ""), message: NSLocalizedString("CreateProperty_Alert_created", comment: ""), vc: self)
  </code></pre>
  
  <p>I am not able to call <code>okAction</code> &amp; cancelAction methods. Tell how to implement call back.</p>