Skip to content
A replacement for UIProgressView that depicts multiple progresses over time
Branch: master
Clone or download
Latest commit e7f3c9b Feb 27, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example improve existing tests, mask track layer to bounds Jan 12, 2019
Images add example .gif Jan 6, 2019
MultiProgressView.xcodeproj set deployment target on carthage framework to 9.0 Jan 9, 2019
MultiProgressView
.gitignore initial commit Jun 26, 2018
LICENSE
MultiProgressView.podspec
README.md

README.md

MultiProgressView

Swift-Version CocoaPods Carthage Compatible license CocoaPods

About

MultiProgressView is an animatable view that depicts multiple progresses over time. The MultiProgressView class mimics UIProgressView as much as possible while providing additional customizations.

Example

To run the example project, clone the repo and run the MultiProgressView-Example target.

Apple Demo

Requirements

  • iOS 9.0+
  • Xcode 10.0+
  • Swift 4.2

Installation

CocoaPods

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

pod 'MultiProgressView'

Carthage

MultiProgressView is also avaiable through Carthage. To install it, simply add the following line to your Cartfile:

github "mac-gallagher/MultiProgressView"

Manual

Download and drop the MultiProgressView directory into your project.

Usage

  1. Add a MultiProgressView to your view hierarchy:

    let progressView = MultiProgressView()
    view.addSubview(progressView)
  2. Conform your class to the MultiProgressViewDataSource protocol and set your progress view's dataSource:

    func numberOfSections(in progressView: MultiProgressView) -> Int
    func progressBar(_ progressView: MultiProgressView, viewForSection section: Int) -> ProgressViewSection
    progressView.dataSource = self
  3. Call the setProgress function to update your view's progress:

    progressView.setProgress(section: 0, to: 0.4)

Customization

MultiProgressView

Each MultiProgressView exposes the following variables:

var cornerRadius: CGFloat = 0
var borderWidth: CGFloat = 0
var borderColor: UIColor? = .black
var lineCap: LineCapType = .round 

var trackInset: CGFloat = 0
var trackBackgroundColor: UIColor? = .white
var trackBorderColor: UIColor? = .black
var trackBorderWidth: CGFloat = 0

var trackImageView: UIImageView?

var trackTitleLabel: UILabel?
var trackTitleEdgeInsets: UIEdgeInsets = .zero
var trackTitleAlignment: AlignmentType = .center

ProgressViewSection

Each ProgressViewSection exposes the following variables:

var imageView: UIImageView?
var titleLabel: UILabel?
var titleEdgeInsets: UIEdgeInsets = .zero
var titleAlignment: AlignmentType = .center

Animating your progress

The setProgress(section:to:) function be animated. For example:

UIView.animate(withDuration: 0.2) {
    self.progressView.setProgress(section: 0, to: 0.4)
}

Contributing

  • If you found a bug, open an issue and tag as bug.
  • If you have a feature request, open an issue and tag as feature.
  • If you want to contribute, submit a pull request.
    • In order to submit a pull request, please fork this repo and submit a pull request from your forked repo.
    • Have a detailed message as to what your pull request fixes/enhances/adds.

To-do

  • Storyboard/IBInspectable support
  • Progress object (Foundation) support

Author

Mac Gallagher, jmgallagher36@gmail.com.

License

MultiProgressView is available under the MIT License, see LICENSE for more infomation.

You can’t perform that action at this time.