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...
An animated trophy banner that looks like Xbox achievement πŸ†

TrophyKit An animated trophy banner that looks like Xbox achievement. Demo demo.mov Usage Requirements iOS 14.0+ tvOS 14.0+ Swift 5.3+ Installation Tr

SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image

SwiftUI.AnimatedImage SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image Screen.Recording.2021-07-31.at.02.18.33.mov Insta

Colorful - A SwiftUI implementation of AppleCard's animated colorful blur background.
Colorful - A SwiftUI implementation of AppleCard's animated colorful blur background.

Colorful - A SwiftUI implementation of AppleCard's animated colorful blur background.

An animated label for displaying numbers
An animated label for displaying numbers

RollingDigitsLabel A simple label that animates a number with each digit falling into place. Installation Swift Package Manager dependencies: [ .p

 AnimatedWaveform provides the user with an animated version of the waveform.circle SF Symbol in SwiftUI.
AnimatedWaveform provides the user with an animated version of the waveform.circle SF Symbol in SwiftUI.

AnimatedWaveform AnimatedWaveform is a Swift Package designed for SwiftUI. It provides the user with an animated version of the waveform.circle SF Sym

Animated Minimal Podcast App UI using SwiftUi 3.0 πŸ€“
Animated Minimal Podcast App UI using SwiftUi 3.0 πŸ€“

Minimal Podcast App UI Animated Minimal Podcast App UI using SwiftUi 3.0 πŸ€“ Video Preview Screenshots Features SwiftUI 3D Card Animation SwiftUI Delay

ButtonClickStyle - This is a Customizable/Designable Button View, with 15 animated click styles, that allows you to design your own buttons from subviews, in storyboard and xib right away.
ButtonClickStyle - This is a Customizable/Designable Button View, with 15 animated click styles, that allows you to design your own buttons from subviews, in storyboard and xib right away.

ButtonClickStyle - This is a Customizable/Designable Button View, with 15 animated click styles, that allows you to design your own buttons from subviews, in storyboard and xib right away.

πŸš€  It Makes easy to track your task πŸ”₯ Beautiful & Animated UIπŸ‘¨πŸ»β€πŸ’»  . Contributions are always welcome πŸ€—
πŸš€ It Makes easy to track your task πŸ”₯ Beautiful & Animated UIπŸ‘¨πŸ»β€πŸ’» . Contributions are always welcome πŸ€—

Taskey πŸš€ What is Taskey πŸ€” ? Taskey is an application build in SwiftUI to track your task with a beautiful animations and UI . Also used core data to

Appstore card animation transition. UICollectionView and UITableView card expand animated transition
Appstore card animation transition. UICollectionView and UITableView card expand animated transition

Appstore card animation transition. UICollectionView and UITableView card expand animated transition. This library tries to add the appstore transition to your own app. The goal is to be as simple as possible to integrate in an app while keeping the flexibility and customization alive.

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
Fully customizable circular progress bar written in Swift.

Fully customizable, circular progress bar written in Swift. Example To run the example project, clone the repo, and run pod install from the Example d

Lionheart Software 137 Nov 11, 2022
A macOS menu bar app for copy animated LIHKG stickers to clipboard.

LIHKG GIFs A macOS menu bar app created for easily sending LIHKG stickers to Microsoft Teams. This app will try to load a GIF selected by user into th

Ice Lam 3 Nov 26, 2022
Simple Animated tabbar with native control

SSCustomTabbar Simple Animated tabbar with native control. Requirements iOS 11.0+ Xcode 10.0+ Installation SSCustomTabbar doesn't contain any external

Simform Solutions 452 Dec 13, 2022
ScriptLib - Early and in progress scripting suite for Swift apps

ScriptLib Early and in progress scripting suite for Swift apps. The goal is to c

Jesse Grosjean 13 Sep 24, 2022
Circular progress Animation

JDCircularProgress JDCircularProgress is animateable UIView that can significantly enhance your users’ experiences and set your app apart from the res

Jawad Ali 8 May 16, 2022
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks

SwiftUI Animation Observer Track SwiftUI animation progress and completion via c

Gordan GlavaΕ‘ 9 Nov 5, 2022
RAProgressRing is the simplest approach to bringing circular progress in your application with minimal code.

RAProgressRing RAProgressRing is the simplest approach to bringing circular progress in your application with minimal code. Features It's customisable

Rohit Arora 5 Nov 4, 2022
Presentation helps you to make tutorials, release notes and animated pages.

Presentation helps you to make tutorials, release notes and animated pages.

HyperRedink 3k Dec 28, 2022
πŸš€ It Makes easy to track your task πŸ”₯ Beautiful & Animated UIπŸ‘¨πŸ»β€πŸ’» . Contributions are always welcome πŸ€—

Taskey ?? What is Taskey ?? ? Taskey is an application build in SwiftUI to track your task with a beautiful animations and UI . Also used core data to

Mohd Yasir 36 Nov 20, 2022