Giter VIP home page Giter VIP logo

uicircularprogressring's Introduction

Banner

A circular progress bar for iOS written in Swift

Styles

Features

  • 2 views, progress or timer
  • Interface builder designable
  • Highly customizable and flexible
  • Easy to use
  • Fluid and interruptible animations
  • Written in Swift
  • RTL language support

Apps Using UICircularProgressRing

Installation

NOTE: Objective-C support: Support for Objective-C has been dropped in version 5.0.0, use version 4 or lower if you are using Objective-C.

CocoaPods (Recommended)

  1. Install CocoaPods

  2. Add this repo to your Podfile

    target 'Example' do
        # IMPORTANT: Make sure use_frameworks! is included at the top of the file
        use_frameworks!
    
        pod 'UICircularProgressRing'
    end
  3. Run pod install

  4. Open up the .xcworkspace that CocoaPods created

  5. Done!

Carthage

Important: Interface builder support with Carthage is either broken or extremely limted

To use with Carthage

  1. Make sure Carthage is installed

    brew install carthage

  2. Add this repo to your Cartfile

    github "luispadron/UICircularProgressRing"

  3. Install dependencies carthage update --platform iOS

Usage

UICircularProgressRing Example

override func viewDidLoad() {
  // Create the view
  let progressRing = UICircularProgressRing()
  // Change any of the properties you'd like
  progressRing.maxValue = 50
  progressRing.style = .dashed(pattern: [7.0, 7.0])
  // etc ...
}

To set a value and animate the view

// Somewhere not in viewDidLoad (since the views have not set yet, thus cannot be animated)
// Remember to use unowned or weak self if referencing self to avoid retain cycle
progressRing.startProgress(to: 49, duration: 2.0) {
  print("Done animating!")
  // Do anything your heart desires...
}

// Pause at any time during a running animation
progressRing.pauseProgress()

// Continue where you left off after a pause
progressRing.continueProgress()

UICircularTimerRing Example

override func viewDidLoad() {
	// create the view
	let timerRing = UICircularTimerRing()
}

Animate and set time

						// seconds
timerRing.startTimer(to: 60) { state in
    switch state {
    case .finished:
        print("finished")
    case .continued(let time):
        print("continued: \(time)")
    case .paused(let time):
        print("paused: \(time)")
    }
}

timerRing.pauseTimer() // pauses the timer

timerRing.continueTimer() // continues from where we paused

timerRing.resetTimer() // resets and cancels animations previously running

Documentation

Please read this before creating an issue about how to use the library:

DOCUMENTATION

Misc.

Do you use this library? Want to be featured? Go here.

uicircularprogressring's People

Contributors

abeltoy-coditramuntana avatar bobgilmore avatar byronsalty avatar chris-redbeed avatar darecki avatar eladhayun avatar gutenbergn avatar jinjorge avatar luispadron avatar nickdnk avatar nikolaisa avatar petewalker avatar ptescher avatar swifttsubame avatar tomerciucran avatar vitl-makan avatar wassup- avatar wvteijlingen avatar younatics avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.