Customizable progress indicator library in Swift

Overview

Gradient Circular Progress

Customizable progress indicator library in Swift

Requirements

  • Swift 5.1
  • iOS 8.0 or later

Screen Shots

  • All preset styles

  • Example Use AddSubView

Installation

Carthage

github "keygx/GradientCircularProgress"

CocoaPods

pod 'GradientCircularProgress', :git => 'https://github.com/keygx/GradientCircularProgress'

Swift versions support

  • Swift 5.1, tag "swift5.1"
  • Swift 5, tag "swift5"
  • Swift 4.2, tag "swift4.2"
  • Swift 4.1, tag "swift4.1"
  • Swift 4.0, tag "swift4.0"

Style Settings

Please make your original styles

  • Define custom style structs that implements the StyleProperty Protocol

MyStyle.swift

import GradientCircularProgress

public struct MyStyle : StyleProperty {
    /*** style properties **********************************************************************************/
    
    // Progress Size
    public var progressSize: CGFloat = 200
    
    // Gradient Circular
    public var arcLineWidth: CGFloat = 18.0
    public var startArcColor: UIColor = UIColor.clear()
    public var endArcColor: UIColor = UIColor.orange()
    
    // Base Circular
    public var baseLineWidth: CGFloat? = 19.0
    public var baseArcColor: UIColor? = UIColor.darkGray()
    
    // Ratio
    public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
    public var ratioLabelFontColor: UIColor? = UIColor.white()
    
    // Message
    public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
    public var messageLabelFontColor: UIColor? = UIColor.white()
    
    // Background
    public var backgroundStyle: BackgroundStyles = .dark
    
    // Dismiss
    public var dismissTimeInterval: Double? = 0.0 // 'nil' for default setting.
    
    /*** style properties **********************************************************************************/
    
    public init() {}
}

Usage

import GradientCircularProgress

Basic

UIWindow

let progress = GradientCircularProgress()

progress.show(message: "Loading...", MyStyle())

progress.dismiss()

addSubView

let progress = GradientCircularProgress()

let progressView = progress.show(frame: rect, message: "Loading...", style: MyStyle())
view.addSubview(progressView!)

progress.dismiss(progress: progressView!)

at Rtio

UIWindow

let progress = GradientCircularProgress()

let ratio: CGFloat = CGFloat(totalBytesWritten) / CGFloat(totalBytesExpectedToWrite)        
progress.showAtRatio(style: MyStyle())

progress.updateRatio(ratio)

progress.dismiss()

addSubView

let progress = GradientCircularProgress()

let progressView = progress.showAtRatio(frame: rect, display: true, style: MyStyle())
view.addSubview(progressView!)

progress.updateRatio(ratio)

progress.dismiss(progress: progressView!)

Update Message

UIWindow

let progress = GradientCircularProgress()

progress.show(message: "Download\n0 / 4", MyStyle())

progress.updateMessage(message: "Download\n1 / 4")
progress.updateMessage(message: "Download\n2 / 4")
progress.updateMessage(message: "Download\n3 / 4")
progress.updateMessage(message: "Download\n4 / 4")
progress.updateMessage(message: "Completed!")

progress.dismiss()

addSubView

let progress = GradientCircularProgress()

let progressView = progress.show(frame: rect, message: "Download\n0 / 4", style: MyStyle())
view.addSubview(progressView!)

progress.updateMessage(message: "Download\n1 / 4")
progress.updateMessage(message: "Download\n2 / 4")
progress.updateMessage(message: "Download\n3 / 4")
progress.updateMessage(message: "Download\n4 / 4")
progress.updateMessage(message: "Completed!")

progress.dismiss(progress: progressView!)

API

Use UIWindow

public func showAtRatio(display: Bool = true, style: StyleProperty = Style())

public func show(style: StyleProperty = Style())

public func show(message: String, style: StyleProperty = Style())

public func dismiss()

public func dismiss(_ completionHandler: () -> Void) -> ()

Use addSubView

public func showAtRatio(frame: CGRect, display: Bool = true, style: StyleProperty = Style()) -> UIView?

public func show(frame: CGRect, style: StyleProperty = Style()) -> UIView?

public func show(frame: CGRect, message: String, style: StyleProperty = Style()) -> UIView?

public func dismiss(progress view: UIView)

public func dismiss(progress view: UIView, completionHandler: () -> Void) -> ()

Common

public func updateMessage(message message: String)

public func updateRatio(_ ratio: CGFloat)

License

Gradient Circular Progress is released under the MIT license. See LICENSE for details.

Author

Yukihiko Kagiyama (keygx) https://twitter.com/keygx

Comments
  • Rounder border at the end of the arc

    Rounder border at the end of the arc

    Hey, is it possible to set the arc to finish with round border?

    It should be possible just adding: myPath.lineJoinStyle = kCGLineJoinRound to the arc path...

    opened by AndreaMiotto 3
  • Carthage error Xcode 7.3.1

    Carthage error Xcode 7.3.1

    Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progres** BUILD FAILED **

    The following build commands failed: CompileSwift normal arm64 CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures) s/ProgressViewController.swift:40:47: error: getter for 'prefersStatusBarHidden' with Objective-C selector 'prefersStatusBarHidden' conflicts with method 'prefersStatusBarHidden()' from superclass 'UIViewController' with the same Objective-C selector A shell task (/usr/bin/xcrun xcodebuild -project /Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GCProgressSample.xcodeproj -scheme GradientCircularProgress -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65: ** BUILD FAILED **

    The following build commands failed: CompileSwift normal arm64 CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures)

    opened by 1ckola 3
  •  Compiler error after update

    Compiler error after update

    After I upgrade GradientCircularProgress var cocoa pod, the compiler error appear. I clean and restart Xcode(Version 7.1.1), but not fix the problem.

    XXXX/Pods/GradientCircularProgress/Source/IndicatorStyle.swift:10:15: Type 'IndicatorStyle' does not conform to protocol 'StyleProperty'

    XXXX//Pods/GradientCircularProgress/Source/OrangeDarkStyle.swift:10:15: Type 'OrangeDarkStyle' does not conform to protocol 'StyleProperty'

    opened by toka756 2
  • Xcode 10 and iOS issues fixed here.

    Xcode 10 and iOS issues fixed here.

    Fix issue #39 and #40

    • [ ] Type 'UIWindow.Level' (aka 'CGFloat') has no member 'alert'
    • [ ] 'didEnterBackgroundNotification' has been renamed to 'NSNotification.Name.UIApplicationDidEnterBackground'
    • [ ] 'willEnterForegroundNotification' has been renamed to 'NSNotification.Name.UIApplicationWillEnterForeground'
    • [ ] Removing Info.plist from the GradientCircularProgress framework to fix the multiple Info.plist in projects.
    opened by southfox 1
  • Manual Install?

    Manual Install?

    hi, great library!

    I am trying to manually install the files in my project, but there's no documentation regarding how to do so.

    I would assume to copy all the files within the Sources/GradientCircularProgress folder, but I can't seem to import GradientCircularProgress as Xcode can't find it.

    Here's what I have in my project:

    untitled

    I am receiving this error in BackgroundTransparentStyle.swift:

    untitled

    Do you happen to know what else I am missing?

    Thanks!

    PS: I've also copied the framework, but to no avail.

    opened by seenoevo 1
  • Error with CocoaPods 1.0.0-beta6

    Error with CocoaPods 1.0.0-beta6

    I updated to CocoaPods Version 1.0.0.

    When I try to install my pods I get this error:

    Pre-downloading: GradientCircularProgress from https://github.com/keygx/GradientCircularProgress [!] The GradientCircularProgress pod failed to validate due to 1 error: - ERROR | attributes: Missing required attribute summary.

    opened by Urkman 1
  • Carthage update failed

    Carthage update failed

    I am getting a following error when I execute Carthage update command in terminal. I am not sure how to proceed. I just updated to the newest version of Xcode which looks like might caused the problem.

    *** Building scheme "GradientCircularProgress" in GCProgressSample.xcodeproj ** BUILD FAILED **

    The following build commands failed: CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/Property.swift CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/GradientArcView.swift CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/ProgressAtRatioView.swift CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (5 failures) /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:76:22: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:85:30: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/Property.swift:15:38: error: use of unresolved identifier 'kCGLineCapButt' /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:76:22: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:85:30: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:76:22: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:85:30: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/GradientArcView.swift:45:13: warning: initialization of immutable value 'a0' was never used; consider replacing with assignment to '_' or removing it /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:76:22: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:85:30: error: '#' has been removed from Swift; double up 'message message' to make the argument label the same as the parameter name A shell task failed with exit code 65: ** BUILD FAILED **

    The following build commands failed: CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/Property.swift CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/GradientArcView.swift CompileSwift normal x86_64 /Users/janusz/Desktop/Repositories/twoKApp/Carthage/Checkouts/GradientCircularProgress/GCProgressSample/GradientCircularProgress/Progress/ProgressAtRatioView.swift CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (5 failures)

    opened by izotx 1
  • Swift Package Manager support

    Swift Package Manager support

    Hello 👋🏻

    We'd like to use your library with SPM instead of Carthage to follow the Xcode evolutions so I come with this PR that changed a bit the global architecture of the project to be compliant with Apple's recommendations for SPM frameworks.

    Architectural changes

    Sources

    The Package.swift file is needed to make this framework usable in SPM workflows. They are now located under the Sources/{FrameworkName} directory.

    Sample App

    It has its own xcodeproj file and a workspace is doing the bridge between the two xcodeproj files. There is no need anymore to have the code duplicate between the two projects.

    Performed verification

    • [x] Carthage build
    • [x] Cocoapods build
    • [x] SPM build

    The builds were played on Xcode 12.5

    I didn't faced any errors in the above cases.

    Conclusion

    I'm looking forward to hear from you and I'm disposed to update my PR with your suggestions.

    Cheers, Arnaud

    opened by ArnaudWurmel 0
  • Use a different method to estimate the size which take Font type into account

    Use a different method to estimate the size which take Font type into account

    Using custom font mess up the ratio label and it shows truncated text. You can try it by using following code in the sample project:

    var style = styleList[seletedStyleIndex].1
    style.ratioLabelFont = UIFont(name: "Lato-Bold", size: 18.0)
    progressView = progress.showAtRatio(frame: getRect(), display: displayFlag, style: style)
    progressView?.layer.cornerRadius = 12.0
    view.addSubview(progressView!)
    
    opened by maniramezan 0
  • dismiss progress immediately

    dismiss progress immediately

    Why there is always a delay before the progress got dismissed? I see that the view gets dismissed withDuration: 0.3, Is there any reason for that?

    I want the progress to be dismissed immediately when I call dismiss

    opened by musa-almatri 0
  • iOS 12 issues with Xcode10

    iOS 12 issues with Xcode10

    Hi guys,

    awesome repository, we are using this for our application, thanks for sharing this.

    I've been trying to build for iOS 12 under Xcode 10 and I'm having the following issues:

    • [ ] = #39 which is reported here
    • [ ] = Type 'UIWindow.Level' (aka 'CGFloat') has no member 'alert'
     //  BaseWindow.swift
    ...
           backgroundColor = UIColor.clear
            windowLevel = UIWindow.Level.alert + 1
            
            makeKey()
    

    // CircularProgressView.swift

    • [ ] = 'didEnterBackgroundNotification' has been renamed to 'NSNotification.Name.UIApplicationDidEnterBackground'
            NotificationCenter.default.addObserver(self,
                                                   selector: #selector(viewDidEnterBackground(_:)),
                                                   name: UIApplication.didEnterBackgroundNotification,
                                                   object: nil)
    
    • [ ] = 'willEnterForegroundNotification' has been renamed to 'NSNotification.Name.UIApplicationWillEnterForeground'
    //  CircularProgressView.swift
            NotificationCenter.default.addObserver(self,
                                                   selector: #selector(viewWillEnterForeground(_:)),
                                                   name: UIApplication.willEnterForegroundNotification,
                                                   object: nil)
    

    Do you want me to send a PR for these issues? Thanks again.

    opened by southfox 1
Owner
keygx
keygx
PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries.

PagingKit provides customizable menu & content UI. It has more flexible layout and design than the other libraries. What's this? There are many librar

Kazuhiro Hayashi 1.3k Jan 9, 2023
A paging view controller with a highly customizable menu ✨

Getting Started | Customization | Installation Features Parchment lets you page between view controllers while showing any type of generic indicator t

Martin Rechsteiner 3k Jan 8, 2023
A fully customizable popup style menu for iOS 😎

Guide Check out the documentation and guides for details on how to use. (Available languages:) English 简体中文 What's a better way to know what PopMenu o

Cali Castle 1.5k Dec 30, 2022
🔻 Dropdown Menu for iOS with many customizable parameters to suit any needs

MKDropdownMenu Dropdown Menu for iOS with many customizable parameters to suit any needs. Inspired by UIPickerView. Installation CocoaPods MKDropdownM

Max Konovalov 531 Dec 26, 2022
Animated side menu with customizable UI

Side Menu Animated side menu with customizable UI. Made in Yalantis. Check this project on dribbble. Check this project on Behance. Requirements iOS 7

Yalantis 2.7k Dec 27, 2022
A simple customizable side menu written in SwiftUI.

NSideMenu Description A simple customizable side menu written in SwiftUI. Give a Star! ⭐ Feel free to request an issue on github if you find bugs or r

null 5 Oct 10, 2022
⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion

CIRCLE MENU Simple, elegant UI menu with a circular layout and material design animations We specialize in the designing and coding of custom UI for M

Ramotion 3.4k Dec 29, 2022
Beautiful iOS side menu library with parallax effect. Written in Swift

AKSideMenu AKSideMenu is a double side menu library with parallax effect. Example Project See the contained examples to get a sample of how AKSideMenu

Diogo Autilio 280 Dec 6, 2022
A swift library based on the various options menu in material design in Android

KTOptionMenu Description KTOptionMenu is a swift library based on the various options menu in material design in Android that allows you to easily cre

null 1 Jul 21, 2022
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶

RHSideButtons ?? Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app

Robert Herdzik 166 Nov 14, 2022
iOS library - UIScrollView driven expandable menu.

UIScrollView driven expandable menu. Description AirBar is a library for creating cool expandable menus. Library observes UIScrollView scroll and prov

Uptech 625 Nov 8, 2022
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
Slide Menu (Drawer) in Swift

AKSwiftSlideMenu Slide Menu (Drawer) in Swift 5.0 Why to use a library everytime? Let's create our own Slide Menu in Swift 5.0 I have uploaded a video

Ashish Kakkad 281 Jan 5, 2023
A simple side menu for iOS written in Swift.

ENSwiftSideMenu A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to

Evgeny Nazarov 1.8k Dec 21, 2022
Interactive view transition to display menus with flowing and bouncing effects in Swift

FlowingMenu FlowingMenu provides an interactive transition manager to display menu with a flowing and bouncing effects. The Objective-C countepart is

Yannick Loriot 975 Dec 21, 2022
Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.

GuillotineMenu.swift Inspired by this project on Dribbble Also, read how it was done in our blog Requirements iOS 8.0+ Xcode 10 Swift 5.0 (v 4.1+) Swi

Yalantis 2.9k Dec 13, 2022
iOS Interactive Side Menu written in Swift.

Interactive Side Menu A customizable, interactive, auto expanding and collapsing side menu for iOS written in Swift. Here are some of the ways Interac

Handsome 706 Dec 15, 2022
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

SlideMenuControllerSwift iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app. Installation CocoaPods pod 'SlideMenuControllerSwift' Carth

Yuji Hato 3.3k Dec 29, 2022
✨ Awesome Dropdown menu for iOS with Swift 5.0

The eligible dropdown menu for iOS, written in Swift 5, appears dropdown menu to display a view of related items when a user click on the dropdown menu. You can customize dropdown view whatever you like (e.g. UITableView, UICollectionView... etc)

Kyle Yi 1.3k Dec 26, 2022