πŸ“Š 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.
πŸ’ˆ 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
A dynamically flowing progress bar.

WWProgressView A dynamically flowing progress bar. δΈ€ε€‹ε‹•ζ…‹ζ΅ε‹•ηš„ι€²εΊ¦ζ’. Installation with Swift Package Manager dependencies: [ .package(url: "https://gith

William-Weng 5 Jan 25, 2022
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Zhouqi Mo 3.3k Dec 21, 2022
An easy to use UI component to help display a signal bar with an added customizable fill animation

TZSignalStrengthView for iOS Introduction TZSignalStrengthView is an easy to use UI component to help display a signal bar with an added customizable

TrianglZ LLC 22 May 14, 2022
Circular progress indicator for your macOS app

CircularProgress Circular progress indicator for your macOS app This package is used in production by apps like Gifski and HEIC Converter. Requirement

Sindre Sorhus 520 Jan 3, 2023
Show progress in your app's Dock icon

DockProgress Show progress in your app's Dock icon This package is used in production by the Gifski app. You might also like some of my other apps. Re

Sindre Sorhus 958 Jan 2, 2023
A custom reusable circular / progress slider control for iOS application.

HGCircularSlider Example To run the example project, clone the repo, and run pod install from the Example directory first. You also may like HGPlaceho

Hamza Ghazouani 2.4k Jan 6, 2023
Progress and Activity Indicators for iOS apps

Progress Indicators and Activity Views for iOS Apps Features Storyboard compatible, configure apprearance with the property inspector. fully animated,

Alexander Kasimir 101 Nov 13, 2022
Work in progress gallery of controls available to Catalyst apps using Optimized for Mac

Catalyst Controls Gallery Very simple work-in-progress demonstration of many common controls available to Mac Catalyst as of macOS 11. Provided moreso

Steven Troughton-Smith 163 Sep 18, 2022
Snapchat / Instagram Stories like progress indicator

SegmentedProgressBar A simple little control that animates segments like Snapchat or Instagram Stories. Requirements iOS 8.0+ Xcode 8 Installation Dra

Dylan Marriott 442 Dec 25, 2022
Measuring the progress with annotations πŸ”±

Description Displaying the progress in a meter control. ProgressMeter lets you create your custom annotations that display either on top or bottom of

Khawaja Farooq 108 Oct 5, 2022
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

Evgenii Neumerzhitckii 874 Dec 13, 2022
A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag

HidesNavigationBarWhenPushed A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed

Danil Gontovnik 55 Oct 19, 2022
A spotlight-inspired quick action bar for macOS.

DSFQuickActionBar A spotlight-inspired quick action bar for macOS. Why? I've seen this in other mac applications (particularly spotlight) and it's ver

Darren Ford 31 Dec 14, 2022
Infinite paging controller, scrolling through contents and title bar scrolls with a delay

PageController PageController is infinite paging controller, scrolling through contents and title bar scrolls with a delay. Then it provide user inter

Hirohisa Kawasaki 408 Nov 28, 2022
Bar Button Item that can be moved anywhere in the screen, like Android's stickers button.

FlowBarButtonItem Bar Button Item that can be moved anywhere in the screen, like Android's stickers button. [![CI Status](http://img.shields.io/travis

noppefoxwolf 153 Sep 15, 2022
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
A customizable color picker for iOS in Swift

IGColorPicker is a fantastic color picker ?? written in Swift. Table of Contents Documentation Colors Style Other features Installation Example Gettin

iGenius 272 Dec 17, 2022
Modular and customizable Material Design UI components for iOS

Material Components for iOS Material Components for iOS (MDC-iOS) helps developers execute Material Design. Developed by a core team of engineers and

Material Components 4.6k Dec 29, 2022