Last active
April 18, 2019 14:45
-
-
Save runys/c3d7c11bb8ed62c5a5dacb58fffd0e14 to your computer and use it in GitHub Desktop.
Activity indicator in iOS 11 with Swift 4
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
// Create the Activity Indicator | |
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) | |
// Add it to the view where you want it to appear | |
view.addSubview(activityIndicator) | |
// Set up its size (the super view bounds usually) | |
activityIndicator.frame = view.bounds | |
// Start the loading animation | |
activityIndicator.startAnimating() | |
// To remove it, just call removeFromSuperview() | |
activityIndicator.removeFromSuperview() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment