Styles

Features

Apps Usig UICircularProgressRing

Usage

Interface Builder

Simply drag a UIView into your storyboard. Make sure to subclass UICircularProgressRingView and that the module points UICircularProgressRing.

Design your heart out

ib-demo.gif

Code

override func viewDidLoad() {
  // Create the view
  let progressRing = UICircularProgressRingView(frame: CGRect(x: 0, y: 0, width: 240, height: 240))
  // Change any of the properties you'd like
  progressRing.maxValue = 50
  progressRing.innerRingColor = UIColor.blue
  // 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 refrencing self to avoid retain cycle
progressRing.setProgress(value: 49, animationDuration: 2.0) {
  print("Done animating!")
  // Do anything your heart desires...
}

Example project

Take a look at the example project over here

  1. Download it
  2. Open the Example.xcworkspace in Xcode
  3. Mess around and experiment!