Last active
September 12, 2016 12:00
-
-
Save YuiChiLo/9d0cb6510f6b51d0cd6c29e9b1c9055d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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