title: What is the best way to check if a UIAlertController is already presenting?
body: <p>I have a tableview which, when loaded, each cell could possibly return an NSError, which I have chosen to display in a UIAlertController.  Problem is I get this error in the console if multiple errors are returned.</p>
  
  <blockquote>
    <p>Warning: Attempt to present UIAlertController: 0x14e64cb00  on MessagesMasterVC: 0x14e53d800 which is already presenting (null)</p>
  </blockquote>
  
  <p>Ideally, I would ideally like to handle this in my UIAlertController extension method.</p>
  
  <pre><code>class func simpleAlertWithMessage(message: String!) -&gt; UIAlertController {
  
      let alertController = UIAlertController(title: nil, message: message, preferredStyle: UIAlertControllerStyle.Alert)
      let cancel = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
  
      alertController.addAction(cancel)
      return alertController
  }
  </code></pre>
  
  <p>Based on matt's answer, I changed the extension to a UIViewController extension, its much cleaner and saves lots of presentViewController code.</p>
  
  <pre><code>    func showSimpleAlertWithMessage(message: String!) {
  
      let alertController = UIAlertController(title: nil, message: message, preferredStyle: UIAlertControllerStyle.Alert)
      let cancel = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
  
      alertController.addAction(cancel)
  
      if self.presentedViewController == nil {
          self.presentViewController(alertController, animated: true, completion: nil)
      }
  }
  </code></pre>