How to create reusable UIAlertcontroller?
<p>I want to create a reusable UIAlertController class for my project.I tried the following code.But my alert is not showing.What is the wrong in my code or any code help.This is my alert class</p>

<pre><code>class AlertView: NSObject {

 class func showAlert(view: UIViewController , message: String){

        let alert = UIAlertController(title: "Warning", message: message, preferredStyle: UIAlertControllerStyle.Alert)
        alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
        view.presentViewController(alert, animated: true, completion: nil)
    }
}
</code></pre>

<p>and i am calling this in my another view controller like</p>

<pre><code>class ViewController: UIViewController {

  override func viewDidLoad() {
      super.viewDidLoad()
      AlertView.showAlert(self, message: "Test alert")
      // Do any additional setup after loading the view, typically from a nib.
   }
}
</code></pre>