You use the OProgressView class to show an ellipse to depict the progress of a task over time.
- Supports any size ellipse, not just circles.
- Provides a label that autopopulates with the current progress value (as a percent).
- Set progress manually or by observing a Progress instance.
- Available in Interface Builder.
To install using Carthage, add the following to your project's Cartfile:
github "epau/OProgressView"
Download and drag into your project all files within the Source folder:
OProgressView.swift
CGPoint+PointOnEllipse.swift
FloatingPoint+DegreesToRadians.swift
UIBezierPath+Percentage.swift
Xcode 8
Swift 3.0
iOS 8.0 +
Initialize an instance of OProgressView just like any other UIView.
let oProgressView = OProgressView()
// Or pass in a frame
let oProgressView = OProgressView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
Adjust the current progress, optionally animating the change.
oProgressView.setProgress(0.80, animated: true)
Or observe a Progress instance.
let progress = Progress(totalUnitCount: 100)
oProgressView.observedProgress = progress
OProgressView's API should feel very familiar as it is designed to match UIProgressView's API.
Many of the same properties are exposed to control the style of the progress view.
// The color shown for the portion of the progress bar that is not filled.
var trackTintColor: UIColor?
// An image to use for the portion of the track that is not filled.
var trackImage: UIImage?
// The color shown for the portion of the progress bar that is filled.
var progressTintColor: UIColor?
// An image to use for the portion of the progress bar that is filled.
var progressImage: UIImage?
There are some additional properties as well.
// The width of the track around the ellipse.
var trackWidth: CGFloat
// The label to display the current progress as a percentage.
var progressLabel: UILabel
// The color shown in the inside of the circle.
var centerBackgroundColor: UIColor?
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Made by epau with ❤️
Inspired by iOS-CircleProgressView
Licensed under the MIT license. See LICENSE for details