title: Dismiss UIAlertView after 5 Seconds Swift
body: <p>I've created a UIAlertView that contains a UIActivityIndicator. Everything works great, but I'd also like the UIAlertView to disappear after 5 seconds. </p>
  
  <p><strong>How can I Dismiss my UIAlertView after 5 seconds?</strong></p>
  
  <pre><code> var alert: UIAlertView = UIAlertView(title: "Loading", message: "Please wait...", delegate: nil, cancelButtonTitle: "Cancel");
  
   var loadingIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(50, 10, 37, 37)) as UIActivityIndicatorView
   loadingIndicator.center = self.view.center;
   loadingIndicator.hidesWhenStopped = true
   loadingIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
   loadingIndicator.startAnimating();
  
   alert.setValue(loadingIndicator, forKey: "accessoryView")
   loadingIndicator.startAnimating()
  
   alert.show()
  </code></pre>