A simple animated progress bar in Swift

Overview

DSGradientProgressView

Swift Version License CocoaPods Compatible Platform

Introduction

DSGradientProgressView is a simple and customizable animated progress bar written in Swift.

Inspired by GradientProgressView.

Demo

Demo gif

The gif looks flickery, but the actual animation on device will not be.

Usage

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

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

Demo set class

Size the view according to your needs. (A 3px height looks great in most cases).

Import DSGradientProgressView in your view controller source file.

import DSGradientProgressView

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

@IBOutlet weak var progressView: DSGradientProgressView!

Customize

You can change the base color of the progress bar. There are two ways to do this:

  • By setting the barColor property of the view object in your source file.
progressView.barColor = UIColor.green
  • Changing the Bar Color property in Storyboard itself.

Demo color picker

Animate

DSGradientProgressView is designed to keep track of the number of requests waiting for completion. Hence the api's are named after semaphore method names. You call the wait() method of the DSGradientProgressView to start animating and signal() method to stop. It hides and un-hides itself accordingly.

progressView.wait()
  // waiting for some resource
progressView.signal()

So, if your View Controller is waiting for more than one network request (or any other resource) and you want the Progress Bar to animate until all the requests are over, you can do that by simply calling wait() that number of times. Later, call signal() the same number of times.

progressView.wait()
  // waiting for some resource asynchronously
ResourceOne.sharedInstance.fetchData { (data, error) in
         self.progressView.signal()
}

progressView.wait()
  // waiting for another resource asynchronously
ResourceTwo.sharedInstance.fetchData { (data, error) in
         self.progressView.signal()
}

Installation

CocoaPods (Recommended)

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build DSGradientProgressView 1.0.0+.

To integrate DSGradientProgressView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'DSGradientProgressView'
end

Then, run the following command:

$ pod install

Manually

Copy the DSGradientProgressView.swift to your Xcode project. That should do it.

Requirements

  • iOS 8.0+
  • Xcode 10.0+
  • Swift 4.2+

Contacts

You might also like...
StatusBarOverlay will automatically show a
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

The easiest way to handle a simple full screen activity indicator in iOS. Written in Swift.
The easiest way to handle a simple full screen activity indicator in iOS. Written in Swift.

LLSpinner An easy way to handle full screen activity indicator. Easy to use Get Started // Show spinner LLSpinner.spin() // Hide spinner LLSpinner.st

Simple HUD.
Simple HUD.

VHUD Simple HUD. VHUD is inspired by PKHUD. Example Show import VHUD func example() { var content = VHUDContent(.loop(3.0)) content.loadingText =

A simple and awesome loading Activity Indicator(with block moving animation) for your iOS app.
A simple and awesome loading Activity Indicator(with block moving animation) for your iOS app.

BPBlockActivityIndicator BPBlockActivityIndicator is a clean and easy-to-use Activity Indicator meant to display the progress of an ongoing task on iO

A metaball loading written in Swift.

DBMetaballLoading Synopsis A metaball loading written in Swift. Special thanks to dodola's MetaballLoading, which is an android project. The animation

A beautiful activity indicator and modal alert written in Swift (originally developed for my app DoodleDoodle) Using blur effects, translucency, flat and bold design - all iOS 8 latest and greatest
A beautiful activity indicator and modal alert written in Swift (originally developed for my app DoodleDoodle) Using blur effects, translucency, flat and bold design - all iOS 8 latest and greatest

SwiftSpinner SwiftSpinner is an extra beautiful activity indicator with plain and bold style. It uses dynamic blur and translucency to overlay the cur

Awesome loading animations using 3D engine written with Swift
Awesome loading animations using 3D engine written with Swift

RSLoadingView Introduction RSLoadingView bring your app to the new age of loading animations using 3D engine. Written with Swift Customizable Using Ap

IOS HUD Swift Library

JHProgressHUD JHProgressHUD is an iOS class written in Swift to display a translucent HUD with an indicator and/or labels while work is being done in

A simple animated progress bar in Swift
A simple animated progress bar in Swift

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

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

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

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

Easy customizable avatar image asynchronously with progress bar animated
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

UIProgressView replacement with an highly and fully customizable animated progress bar in pure Core Graphics
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

 Progress.swift ⌛ Add beautiful progress bars to your loops.
Progress.swift ⌛ Add beautiful progress bars to your loops.

Progress.swift ⌛ Just wrap the SequenceType in your loop with the Progress SequenceType and you'll automatically get beautiful progress bars. Updating

MultiPeer-Progress-iOS - Swift project to demo the use of the MultiPeer framework to send files between iOS devices and show the progress PBCircularProgressView is a circular progress view for iOS similar to the app store download progress view.
PBCircularProgressView is a circular progress view for iOS similar to the app store download progress view.

Overview PBCircularProgressView is a circular progress view for iOS similar to the app store download progress view. It also ha

Snake Progress shows circular progress for iOS Apps.
Snake Progress shows circular progress for iOS Apps.

SnakeProgress SnakeProgress shows circular progress for iOS Apps. With SnakeProgress With SnakeProgress, you can easily circular progress. @IBOutlet w

A small and flexible (well documented)  UIButton subclass with animated loading progress, and completion animation.
A small and flexible (well documented) UIButton subclass with animated loading progress, and completion animation.

ButtonProgressBar-iOS Example For LIVE PREVIEW on Appetize in your browser itself, click here. To run the example project, clone the repo, and run pod

Comments
  • couldnt loop the progressView animation

    couldnt loop the progressView animation

    i have do the instruction,

    call progressView.wait() before fetch data,

    after receive call back call progressView.signal(),

    but during loading, the progress animation

    just run the short time and stop automatically,

    could some one help me what step did i miss?

    opened by hungwei0331 1
  • Its getting stopped when cell is loaded again.

    Its getting stopped when cell is loaded again.

    I am using this view in UITableViewCell, but when tableView gets loaded again, Progress view stops. Here is code : class scannerTableViewCell: UITableViewCell {

    @IBOutlet weak var progressView: DSGradientProgressView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        progressView.barColor = UIColor.theme()
        progressView.wait()
       
    }
    

    }

    opened by ankitgarg135 1
Releases(1.0.1)
Owner
Dhol Studio
Dhol Studio
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
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 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
💈 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
⌛️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
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
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
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
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