Loadable allows you to attach
Progress to any
UIView or subclass and then use the
UIView to display progress. You can animate the progress, set the progress colour and show or hide the percentage progress in the bottom corner of your view. Please see below for demos of Loadable working on a
UIView and a
To run the example project, clone the repo, and run
pod install from the Example directory first.
Loadable is available through CocoaPods. To install it, simply add the following line to your Podfile:
- Swift 5.0
- iOS 11.0
👩💻 How to use
Loadable can be used on any
UIView or subclass. As it is built as an extension of
UIView, the only thing you need to do to use it is import it at the top of your file. After that you can configure the view you want to use as a loading view with a few different options as follows:
let viewToShowLoading: UIView = UIView() let progress = Progress(totalUnitCount: 100) viewToShowLoading.monitoredProgress = progress // everything from here on is optional configuration. The lines above will setup everything viewToShowLoading.animateProgrss = true viewToShowLoading.progressColor = .blue viewToShowLoading.showPercentage = true viewToShowLoading.progressPercentageFontSize = 12.0 viewToShowLoading.progressPercentageFontColor = .red viewToShowLoading.clearOnComplete = false
As you can see from the comment in the above snippet, all that is necessary to make the
UIView become a Loadable one is attaching some
Progress to the new
monitoredProgress property. After that you can configure the Loadable view any way you like.
If you run into any problems, please submit an issue. Pull requests are also welcome! By contributing to Loadable you agree that your contributions will be licensed under its MIT license.
If you use Loadable in your app I'd love to hear from you on Twitter!
WaveTab was created by Matthew Pierce (@PierceMatthew)
Loadable is available under the MIT license. See the LICENSE file for more info.