Created
May 6, 2019 13:28
-
-
Save giln/9de8bd4546b88234290c56ba6836f907 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
open class LoadingViewController: UIViewController { | |
// MARK: - Variables | |
public let activityIndicator = UIActivityIndicatorView(style: .gray) | |
// MARK: - Lifecycle | |
open override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = UIColor.white | |
activityIndicator.hidesWhenStopped = true | |
view.addSubview(activityIndicator) | |
activityIndicator.center(in: view) | |
} | |
open override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
activityIndicator.startAnimating() | |
} | |
open override func viewWillDisappear(_ animated: Bool) { | |
super.viewWillDisappear(animated) | |
activityIndicator.stopAnimating() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment