Custom animating gradient progress bar.
TYProgressBar is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TYProgressBar'
let progressBar = TYProgressBar()
func setupProgressBar() {
progressBar.frame = CGRect(x: 0, y: 0, width: 220, height: 220)
progressBar.center = self.view.center
self.view.addSubview(progressBar)
}
You can change gradient color and label font and text color
progressBar.trackColor = UIColor(white: 0.2, alpha: 0.5)
progressBar.gradients = [UIColor.red, UIColor.yellow]
progressBar.textColor = .orange
progressBar.font = UIFont(name: "HelveticaNeue-Medium", size: 22)!
progressBar.lineDashPattern = [10, 4] // lineWidth, lineGap
progressBar.lineHeight = 5
progressBar.progress = 0.5 // between 0 to 1
Yash Thaker, [email protected]
TYProgressBar is available under the MIT license. See the LICENSE file for more info.