• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    Swift
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fully customizable circular progress bar written in Swift.

CI Status Version License Platform 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 directory first. You can also view the example app at Appetize.io.

Usage

At the top of your file, make sure to import "ConcentricProgressRingView"

import ConcentricProgressRingView

Then, instantiate ConcentricProgressRingView in your view controller:

func viewDidLoad() {
    super.viewDidLoad()

    let fgColor1 = UIColor.yellow
    let bgColor1 = UIColor.darkGray
    let fgColor2 = UIColor.green
    let bgColor2 = UIColor.darkGray

    let rings = [
        ProgressRing(color: fgColor1, backgroundColor: bgColor1, width: 18),
        ProgressRing(color: fgColor2, backgroundColor: bgColor2, width: 18),
    ]

    let margin: CGFloat = 2
    let radius: CGFloat = 80
    let progressRingView = ConcentricProgressRingView(center: view.center, radius: radius, margin: margin, rings: rings)

    view.addSubview(progressRingView)
}

You can customize the width, margin, and radius, along with the number of rings. Here's another example with 6 progress rings, with a smaller bar width, larger margin between rings, and a larger radius:

let rings = [
    ProgressRing(color: fgColor1, backgroundColor: bgColor1, width: 10),
    ProgressRing(color: fgColor2, backgroundColor: bgColor2, width: 10),
    ProgressRing(color: fgColor1, backgroundColor: bgColor1, width: 10),
    ProgressRing(color: fgColor2, backgroundColor: bgColor2, width: 10),
    ProgressRing(color: fgColor1, backgroundColor: bgColor1, width: 10),
    ProgressRing(color: fgColor2, backgroundColor: bgColor2, width: 10),
]

let margin: CGFloat = 10
let radius: CGFloat = 120
let progressRingView = ConcentricProgressRingView(center: view.center, radius: radius, margin: margin, rings: rings)

Repeating widths can get a bit tedious, so you can omit them---but you'll still need to provide default values to the initializer. If you don't, the compiler will warn you that there's a problem. The initializer can throw if you provide invalid parameters, so you'll need to handle that.

let rings = [
    ProgressRing(color: fgColor1, backgroundColor: bgColor1),
    ProgressRing(color: fgColor2, backgroundColor: bgColor2),
    ProgressRing(color: fgColor1, backgroundColor: bgColor1),
    ProgressRing(color: fgColor2, backgroundColor: bgColor2),
    ProgressRing(color: fgColor1, backgroundColor: bgColor1),
    ProgressRing(color: fgColor2, backgroundColor: bgColor2),
]

let margin: CGFloat = 10
let radius: CGFloat = 120
let width: CGFloat = 8
let progressRingView = try? ConcentricProgressRingView(center: view.center, radius: radius, margin: margin, rings: rings, defaultColor: nil, defaultWidth: width)

Rings can have varying widths, colors, and background colors.

let rings = [
    ProgressRing(color: UIColor(.RGB(160, 255, 0)), backgroundColor: UIColor(.RGB(44, 66, 4)), width: 40),
    ProgressRing(color: UIColor(.RGB(255, 211, 0)), backgroundColor: UIColor(.RGB(85, 78, 0)), width: 20),
    ProgressRing(color: UIColor(.RGB(255, 28, 93))),
]
let progressRingView = try! ConcentricProgressRingView(center: view.center, radius: radius, margin: margin, rings: rings, defaultWidth: 30)

Updating Progress

To animate a progress update, use setProgress.

ring.arcs[1].setProgress(0.5, duration: 2)

You can also use subscripts to access the individual arcs.

ring[1].setProgress(0.5, duration: 2)

If you just want to change the progress, just set the progress on the ring, and it'll change immediately.

ring[1].progress = 0.5

If you'd like to update multiple rings simulataneously, you can iterate over ConcentricProgressRingView since it conforms to SequenceType.

for ring in progressRingView {
    ring.progress = 0.5
}

Requirements

Installation

ConcentricProgressRingView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ConcentricProgressRingView"

TODO

  • Swift 3
  • Documentation
  • Tests

Author

Dan Loewenherz, [email protected]

License

ConcentricProgressRingView is available under the Apache 2.0 license. See the LICENSE file for more info.

More Repositories

1

bottlenose

A Python wrapper for the Amazon Product Advertising API.
Python
578
star
2

pinboard.py

A full-featured Python wrapper (and command-line utility) for the Pinboard API. Built by the makers of Pushpin for Pinboard.
Python
342
star
3

openradar-mirror

A mirror of radars pulled from http://openradar.me/.
Python
246
star
4

django-pyodbc

An ODBC-powered MS SQL Server DB backend for Django 1.4+
Python
203
star
5

git-bigstore

Bigstore is a Git extension that helps you track big files in your repositories.
Python
183
star
6

LHSKeyboardAdjusting

An easy-to-use Objective-C protocol that automatically resizes / adjusts views when a keyboard appears on iOS.
Objective-C
100
star
7

ASPinboard

A modern, fast, and flexible Objective-C library for Pinboard.in.
Objective-C
83
star
8

TipJarViewController

Easy, drop-in tip jar for iOS apps.
Swift
78
star
9

requests-cloudkit

Apple CloudKit Python library.
Python
70
star
10

django-template

A battle-tested Django 2.1 project template with configurations for AWS, Heroku, App Engine, and Docker.
Python
64
star
11

in_app_purchase_receipt_verifier

A simple, one-click deploy web app to simplify the process of validating In-App Purchase receipts on the App Store.
Python
58
star
12

python-harvest

A Python wrapper for the Harvest time-tracking API.
Python
55
star
13

SuperLayout

SuperLayout is a Swift library that makes using Auto Layout a breeze.
Swift
52
star
14

django-on-appengine-archive

Jumpstart Django development on Google Appengine.
Python
49
star
15

pwnedpasswords

A Python Library and CLI for the Pwned Passwords v2 API
Python
47
star
16

KeyboardAdjuster

A Swift library that automatically resizes and adjusts views to scroll when a keyboard appears.
Swift
40
star
17

objectifier

Objectify your Python objects.
Python
37
star
18

TimeTracker-Linux

A Harvest client for Ubuntu Linux.
Python
21
star
19

Notchy

Notchy is an iOS app that makes pretty, shareable screenshots for the iPhone X and the iPhone XS.
Swift
20
star
20

LionheartExtensions

An invaluable collection of Swift extensions and utilities for iOS.
Swift
14
star
21

django-pwnedpasswords-validator

Django password validator that checks for passwords in known data breaches.
Python
13
star
22

python-onfleet

A full-featured Python wrapper for the Onfleet API.
Python
11
star
23

TableViewPopoverPresenting

Display popovers on taps over your table views cells. It was hard. Now it's easy.
Swift
9
star
24

QuickTableView

UITableView toolset for Swift.
Swift
9
star
25

python-leafly

Python
8
star
26

django-lionheart-helpers

A small collection of utilities for use with Django.
Python
8
star
27

django-statictastic

A Django app that makes it easy to sync static files to your storage backend of choice.
Python
8
star
28

python-restmapper

RestMapper takes the pain out of integrating with RESTful APIs.
Python
8
star
29

LionheartCurrencyTextField

A drop-in replacement for UITextField that displays currency values the way you’d expect it to.
Swift
8
star
30

LHSFontSelectionViewController

Objective-C
7
star
31

WelcomeViewController

A welcome view in the style of Apple's built-in apps.
Swift
7
star
32

LHSColorPickerView

Objective-C
4
star
33

fastlane-plugin-submit_to_beta_app_review

A simple plugin that submits an iTunes Connect build to Beta App Review.
Ruby
4
star
34

Health-XML-Splitter

A macOS utility that splits Health XML files into smaller chunks.
Swift
4
star
35

pushpin-localizations

Translations for Pushpin, a Pinboard client for iOS.
Shell
3
star
36

LHSDelicious

An easy-to-use Objective-C wrapper for the Delicious API.
Objective-C
3
star
37

Xcode-Templates

Makefile
3
star
38

LHSCategoryCollection

A collection of helpful categories for use in iOS projects.
Objective-C
3
star
39

style-guide

2
star
40

LHSCategoriesFlowView

Objective-C
2
star
41

iOSTipsTricks

Objective-C
2
star
42

IAPReceiptVerifier

Companion iOS library to https://github.com/lionheart/in_app_purchase_receipt_verifier
Swift
2
star
43

LHSKippt

not much to see here, move along
Objective-C
2
star
44

milestonemaker

Just a quick and dirty script that creates weekly milestones in GitHub issues.
Python
2
star
45

UncommonCrypto

Pure Swift wrapper for CommonCrypto.
HTML
2
star
46

LHSDiigo

Objective-C
2
star
47

LionheartOtherAppsViewController

A view controller that showcases all the apps you currently have on the App Store.
Swift
2
star
48

LHSTableViewCells

A Pod that allows you to make tableViewCells without subclassing them
Objective-C
1
star
49

LHSTwitterFollowUtility

A utility that allows your users to follow a specific twitter account.
Objective-C
1
star
50

mixpanel-people-delete

A one-click Heroku app that resets your Mixpanel People usage.
Python
1
star
51

github-issues-tools

Python
1
star
52

LHSCustomTransitionCollection

A collection of custom transitions for use in iOS 7+
Objective-C
1
star
53

releasemaker

Python
1
star
54

LionheartAlamofireClient

A simple class that helps manage interaction with remote APIs using Alamofire.
Swift
1
star
55

LHSOtherAppsViewController

A view controller to show your users the other apps that you have developed.
Objective-C
1
star
56

lionheart-tumblr-theme

The Lionheart Software Tumblr Blog Theme
CSS
1
star