📊 A customizable gradient progress bar (UIProgressView).

Overview

GradientProgressBar

Swift5.0 CI Status Code Coverage Version License Platform

A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen.

Example

Example

To run the example project, clone the repo, and open the workspace from the Example directory.

Requirements

  • Swift 5.0
  • Xcode 11
  • iOS 9.0+

Integration

CocoaPods

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 Podfile:

pod 'GradientProgressBar', '~> 2.0'
Carthage

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 Cartfile:

github "fxm90/GradientProgressBar" ~> 2.0

Run carthage update to build the framework and drag the built GradientProgressBar.framework, as well as the dependency LightweightObservable.framework, into your Xcode project.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. 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 dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/fxm90/GradientProgressBar", from: "2.0.3")
]

How to use

Simply drop a UIView into your View Controller in the Storyboard. Select your view and in the Identity Inspector change the class to GradientProgressBar.

Don't forget to change the module to GradientProgressBar too.

Interface Builder

Setup the constraints for the UIView according to your needs.

Import GradientProgressBar in your view controller source file.

import GradientProgressBar

Create an IBOutlet of the progress view in your view controller source file.

@IBOutlet weak var gradientProgressView: GradientProgressBar!

After that you can set the progress programmatically as you would do on a normal UIProgressView.

gradientProgressView.setProgress(0.75, animated: true)
gradientProgressView.progress = 0.75

Configuration

– Property animationDuration

Adjusts the animation duration for calls to setProgress(_:animated:):

progressView.animationDuration = 2.0
progressView.setProgress(progress, animated: true)

– Property gradientColors

Adjusts the colors, used for the gradient inside the progress-view.

progressView.gradientColors: [UIColor] = [
    .red,
    .white,
    .blue
]

– Property timingFunction

Adjusts the timing function for calls to setProgress(_:animated:), with animated set to true.

progressView.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)

Troubleshooting

Interface Builder Support

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 install again. Afterwards you should be able to use the GradientProgressBar inside the Interface Builder :)

  post_install do |installer|
    installer.pods_project.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

Show progress of WKWebView

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 estimatedProgress of the WKWebView.

Please have a look at the example application for further details :)

Author

Felix Mau (me(@)felix.hamburg)

License

GradientProgressBar is available under the MIT license. See the LICENSE file for more info.

Comments
  • Timing parameter for render a new color set

    Timing parameter for render a new color set

    Hi. Is there any way to change timing parameter for render a new color set? Now it's executed with lite fade, but sometimes I need to change color immediately. For example in viewDidAppear method, for prepare UI.

    opened by JLightMedia 6
  • GradientProgressBar couldn't be subclassed

    GradientProgressBar couldn't be subclassed

    GradientProgressBar couldn't be subclassed outside the its module for now, cause it's a public class. I think it would be better to change public class to open one.

    // error message
    // Cannot inherit from non-open class 'GradientProgressBar' outside of its defining module
    
    
    public class GradientProgressBar: UIProgressView {}
    // ->
    open class GradientProgressBar: UIProgressView {}
    
    opened by iTofu 4
  • cornerRadius for the layers does not work

    cornerRadius for the layers does not work

    setting the cornerRadius property for both layers: the gradient layer and mask layer has no effect, is there a way to change the corner radius for them so that (for example) the edges of the progress appear rounded ?

    opened by murad1981 4
  • init(dynamicProvider:)' is only available in tvOS 13.0 or newer

    init(dynamicProvider:)' is only available in tvOS 13.0 or newer

    I'm getting error for availability of API. Error is in an extension. I'm using swift package manager and i'm on latest version of library which is 2.0.3.

    Screenshot 2020-03-13 at 1 36 01 PM
    opened by shahbazsaleem01 3
  • Run Failed

    Run Failed

    /Users/libern/Library/Developer/Xcode/DerivedData/GradientProgressBar-abnadadssqkjjaabhyarqsrpdscz/Build/Intermediates.noindex/GradientProgressBar.build/Debug-iphoneos/GradientProgressBar_Example.build/Script-970D1F17201BB73D00F90864.sh: line 8: 62282 Killed: 9 $SWIFTFORMAT ../ Command PhaseScriptExecution failed with a nonzero exit code

    opened by libern 2
  • Add support for SwiftUI

    Add support for SwiftUI

    Open Tasks

    • [x] Check CI
    • [x] Check CocoaPods integration works
    • [x] Check Carthage integration works
    • [x] Check SPM integration works
    • [x] Update documentation for SwiftUI code
    • [x] Update README.md
    opened by fxm90 0
Owner
Felix M.
iOS & Frontend Developer 📲 https://twitter.com/_fxm90 🐦 https://codepen.io/fxm90 🖥 https://instagram.com/fxm90 📸
Felix M.
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

Yonat Sharon 340 Dec 16, 2022
⌛️A customizable animated gradient loading bar.

GradientLoadingBar A customizable animated gradient loading bar. Inspired by iOS 7 Progress Bar from Codepen. Example To run the example project, clon

Felix M. 791 Dec 26, 2022
Flexible Stepped Progress Bar for IOS

FlexibleSteppedProgressBar This is a stepped progress bar for IOS. The base code is derived from ABSteppedProgressBar. Most of the design is customisa

Amrata Baghel 549 Jan 6, 2023
A simple animated progress bar in Swift

DSGradientProgressView Introduction DSGradientProgressView is a simple and customizable animated progress bar written in Swift. Inspired by GradientPr

Dhol Studio 445 Oct 13, 2022
Simple and powerful animated progress bar with dots

Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ Swift 3.0+ Installatio

Nikola Corlija 42 Dec 5, 2022
💈 Retro looking progress bar straight from the 90s

Description Do you miss the 90s? We know you do. Dial-up internet, flickering screens, brightly colored websites and, of course, this annoyingly slow

HyperRedink 18 Nov 24, 2022
Material Linear Progress Bar for your iOS apps

LinearProgressBar Material Linear Progress Bar for your iOS apps Installation Carthage: github "Recouse/LinearProgressBar" CocoaPods: Add this to you

Firdavs Khaydarov 161 Dec 5, 2022
Completely customizable progress based loaders drawn using custom CGPaths written in Swift

FillableLoaders Completely customizable progress based loaders drawn using custom CGPaths written in Swift Waves Plain Spike Rounded Demo: Changelog:

Pol Quintana 2.1k Dec 31, 2022
Simple Swift Progress HUD

MKProgress An iOS Simple Swift Progress HUD Requirements iOS 9.0+ Swift 3.0+ Xcode 8.0+ Installation MKProgress is only available via CocoaPods: pod '

Muhammad Kamran 143 Dec 23, 2022
A clean and lightweight progress HUD based on SVProgressHUD, converted to Swift with the help of Swiftify.

IHProgressHUD IHProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS. IHProgressHUD is based on

Swiftify 202 Dec 22, 2022
StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again

StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch

Idle Hands Apps 160 Nov 2, 2022
📊 A customizable gradient progress bar (UIProgressView).

GradientProgressBar A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen. Example To run the example pro

Felix M. 490 Dec 16, 2022
UIProgressView replacement with an highly and fully customizable animated progress bar in pure Core Graphics

The YLProgressBar is an UIProgressView replacement with a highly and fully customizable animated progress bar in pure Core Graphics. It has been imple

Yannick Loriot 1.3k Jan 5, 2023
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

Yonat Sharon 340 Dec 16, 2022
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

Yonat Sharon 340 Dec 16, 2022
⌛️A customizable animated gradient loading bar.

GradientLoadingBar A customizable animated gradient loading bar. Inspired by iOS 7 Progress Bar from Codepen. Example To run the example project, clon

Felix M. 791 Dec 26, 2022
⌛️A customizable animated gradient loading bar.

GradientLoadingBar A customizable animated gradient loading bar. Inspired by iOS 7 Progress Bar from Codepen. Example To run the example project, clon

Felix M. 791 Dec 26, 2022
UIView based progress bar that shows a progress based on duration in seconds

DurationProgressBar Create a progress bar based on a duration in seconds. The view is fully customisable. Install Add this repository to your swift pa

Cem Olcay 2 May 21, 2022
Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wallpaper image

Change menu bar color in macOS Big Sur Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wal

Igor Kulman 876 Jan 5, 2023
Easy customizable avatar image asynchronously with progress bar animated

JDSwiftAvatarProgress ##Objective-C JDAvatarProgress is available in Objective-C also, JDAvatarProgress Usage To run the example project, clone the re

Jelly Development 86 May 16, 2022