📊 A customizable gradient progress bar (UIProgressView).
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen.
To run the example project, clone the repo, and open the workspace from the Example directory.
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate GradientProgressBar into your Xcode project using CocoaPods, specify it in your
ruby pod 'GradientProgressBar', '~> 2.0'
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate GradientProgressBar into your Xcode project using Carthage, specify it in your
ogdl github "fxm90/GradientProgressBar" ~> 2.0Run carthage update to build the framework and drag the built
GradientProgressBar.framework, as well as the dependency
LightweightObservable.framework, into your Xcode project.
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the
swiftcompiler. It is in early development, but Gradient Progress Bar does support its use on supported platforms.
Once you have your Swift package set up, adding Gradient Progress Bar as a dependency is as easy as adding it to the
dependenciesvalue of your
dependencies: [ .package(url: "https://github.com/fxm90/GradientProgressBar", from: "2.0.3") ]
Simply drop a
UIViewinto your View Controller in the Storyboard. Select your view and in the
Identity Inspectorchange the class to
Don't forget to change the module toGradientProgressBartoo.
Setup the constraints for the
UIViewaccording to your needs.
GradientProgressBarin your view controller source file.
swift import GradientProgressBarCreate an
IBOutletof the progress view in your view controller source file.
swift @IBOutlet weak var gradientProgressView: GradientProgressBar!After that you can set the progress programmatically as you would do on a normal UIProgressView.
swift gradientProgressView.setProgress(0.75, animated: true)
swift gradientProgressView.progress = 0.75
Adjusts the animation duration for calls to
swift progressView.animationDuration = 2.0 progressView.setProgress(progress, animated: true)
Adjusts the colors, used for the gradient inside the progress-view.
swift progressView.gradientColors: [UIColor] = [ .red, .white, .blue ]
Adjusts the timing function for calls to
setProgress(_:animated:), with animated set to
swift progressView.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
Unfortunatly the Interface Builder support is currently broken for Cocoapods frameworks. If you need Interface Builder support, add the following code to your Podfile and run
pod installagain. Afterwards you should be able to use the
GradientProgressBarinside the Interface Builder :) ``` postinstall do |installer| installer.podsproject.build_configurations.each do |config| next unless config.name == 'Debug'
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [ '$(FRAMEWORK_SEARCH_PATHS)' ] end
end ``` Source: Cocoapods – Issue 7606
Based on my gist, the example application also contains the sample code, for attaching the progress view to a
UINavigationBar. Using "Key-Value Observing" we change the progress of the bar accordingly to the property
Please have a look at the example application for further details :)
Felix Mau (me(@)felix.hamburg)
GradientProgressBar is available under the MIT license. See the LICENSE file for more info.