Skip to content

Instantly share code, notes, and snippets.

@YuiChiLo
Last active September 12, 2016 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YuiChiLo/9d0cb6510f6b51d0cd6c29e9b1c9055d to your computer and use it in GitHub Desktop.
Save YuiChiLo/9d0cb6510f6b51d0cd6c29e9b1c9055d to your computer and use it in GitHub Desktop.
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