This library can do two things.
- Displaying a long loading screen despite the processing that ends early.
- It takes a long time, but it looks as if loading is going at a fast speed.
let scam = ScamLoadingView(title: "loading...", limitValue: 0.8, arrivalTime: 10.0)
//Show loading View
self.present(scam.loadingViewController, animated: true, completion: nil)
DispatchQueue.global(qos: .default).async {
//Some processing
Thread.sleep(forTimeInterval: 3.0)
DispatchQueue.main.async {
//Call after you finish processing
scam.complete {
scam.loadingViewController.dismiss(animated: true, completion: nil)
}
}
}
In this example, regardless of the content of the process, the loading will advance to 80% in 10 seconds.
Swift 3.0+
iOS 10.0+
ScamLoadingView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ScamLoadingView"
[Shuhei Sowa], [sowashuhei@gmail.com]
ScamLoadingView is available under the MIT license. See the LICENSE file for more info.