Skip to content

Instantly share code, notes, and snippets.

Last active October 27, 2018 14:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save marcos1262/8028e1b4a7eb56339a26ce5121d98fbc to your computer and use it in GitHub Desktop.
Spinner indicator to put over loading views
extension UIViewController {
func displaySpinner(onView : UIView) -> UIView {
let spinnerView = UIView.init(frame: onView.bounds)
spinnerView.backgroundColor = UIColor.white //
let ai = UIActivityIndicatorView(style: .gray)
ai.startAnimating() =
DispatchQueue.main.async {
return spinnerView
func removeSpinner(spinner :UIView) {
DispatchQueue.main.async {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment