TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2016 |
SPMSupports SPM | ✗ |
Maintained by MartinMoizard.
Progressable is a simple component to help you add a simple animatable progress bar to any UIView.
3 simple stops to follow:
UIView
conform to the Progressable
protocol.self.initProgress()
in init(frame: CGRect)
and init?(coder aDecoder: NSCoder)
.self.layoutProgress()
in func layoutSubviews()
.After conforming to the Progressable
protocol, you change the progress using:
progress
property: self.progressView.progress = 50
(values are from 0 to 100).setProgress(progress: CGFloat, withDuration duration: TimeInterval)
method.The following properties can be customized:
progressLineWidth
: width of the progress bar.progressColor
: color of the progress bar.class ProgressSearchBar: UISearchBar, Progressable {
override init(frame: CGRect) {
super.init(frame: frame)
self.initProgress()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initProgress()
}
override func layoutSubviews() {
super.layoutSubviews()
self.layoutProgress()
}
}
This example can be run using Progressable.xcodeproj
.