Loadable

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 UISegmentControl.

Usage

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.

About

I built Loadable to allow developers to make nicer loading features, such as allowing whole UITableViewCells to load with progress. You can check out the full git repo here.


twitter · github · who is matt? · writing · projects · home