A gradient progress bar (UIProgressView). Inspired by iOS Style Gradient Progress Bar with Pure CSS/CSS3.
GradientProgress can be added to your project using CocoaPods by adding the following line to your Podfile:
Clone the repo and drag the file
GradientProgress.swift into your Xcode project.
Simply drop a
UIProgressView into your View Controller in the Storyboard. Select your progress view and in the
Identity Inspector change the class to
Don't forget to change the module to
Setup the constraints for the UIProgressView according to your needs.
GradientProgress in your view controller source file.
IBOutlet of the progress view in your view controller source file.
@IBOutlet weak var progressView: GradientProgress!
After that you can set the progress programmatically as you would do on a normal UIProgressView.
progressView.setProgress(0.5, animated: true) progressView.progress = 0.75
You can change gradient colors and corner radius:
progressView.gradientColors = [UIColor.yellow.cgColor, UIColor.black.cgColor] progressView.cornerRadius = 10