Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import UIKit
/// Syntax Swift 2.2
extension UIAlertController {
class func showIndicatorAlert(viewController: UIViewController, message: String) {
let alert: UIAlertController = self.init(title: nil, message: message, preferredStyle: .Alert)
// Add Indicator
let indicator = UIActivityIndicatorView(activityIndicatorStyle: .Gray)
indicator.center = CGPoint(x: 25, y: 30)
alert.view.addSubview(indicator)
dispatch_async(dispatch_get_main_queue(), {
indicator.startAnimating()
viewController.presentViewController(alert, animated: true, completion: nil)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.