MultiProgressView

一个可动画显示多个进度的视图。以 UIProgressView 为模型。「📊 An animatable view that depicts multiple progresses over time. Modeled after UIProgressView」

Github星跟踪图








📊 MultiProgressView is an animatable view that depicts multiple progresses over time. Modeled after UIProgressView.


Examples

To run the example project, clone the repo and run the MultiProgressViewExample target.

Basic Usage

Programmatic

  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 progressView(_ progressView: MultiProgressView, viewForSection section: Int) -> ProgressViewSection
    
    progressView.dataSource = self
    
  3. Call setProgress(section:to:) to update your view's progress:

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

Storyboards

  1. Drag a UIView onto your view controller and set the view's class to MultiProgressView in the Identity Inspector:

    IdentityInspector

  2. Connect your progress view to your view controller with an IBOutlet:

    IBOutlet

  3. Conform your view controller to the MultiProgressViewDataSource protocol and implement the required methods:

     func numberOfSections(in progressView: MultiProgressView) -> Int
     func progressView(_ progressView: MultiProgressView, viewForSection section: Int) -> ProgressViewSection
    
  4. Set your view controller as the progress view's dataSource:

    DataSource

  5. Call setProgress(section:to:) to update your view's progress:

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

Customization

MultiProgressView

Each MultiProgressView exposes the variables listed below. If using storyboards, many of these properties can be customized directly in the view's Attribute Inspector.

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

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

var trackImageView: UIImageView

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

Note: To apply a corner radius (using layer.cornerRadius or the cornerRadius variable) the lineCap type must be set to .round.

ProgressViewSection

Each ProgressViewSection exposes the following variables:

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

Installation

CocoaPods

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

pod 'MultiProgressView'

Carthage

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

github "mac-gallagher/MultiProgressView"

Swift Package Manager

MultiProgressView is available through Swift PM. To install it, simply add the package as a dependency in Package.swift:

dependencies: [
  .package(url: "https://github.com/mac-gallagher/MultiProgressView.git", from: "1.2.0"),
]

Manual

Download and drop the MultiProgressView directory into your project.

Requirements

  • iOS 9.0+
  • Xcode 10.2+
  • Swift 5.0+

Apps Using MultiProgressView

We love to hear about apps that use MultiProgressView - feel free to submit a pull request and share yours here!


主要指标

概览
名称与所有者mac-gallagher/MultiProgressView
主编程语言Swift
编程语言Swift (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2018-06-26 00:36:00
推送于2021-03-27 14:41:12
最后一次提交2020-07-03 03:11:47
发布数18
最新版本名称v1.3.0 (发布于 )
第一版名称0.1.0 (发布于 )
用户参与
星数1k
关注者数14
派生数63
提交数125
已启用问题?
问题数14
打开的问题数5
拉请求数34
打开的拉请求数1
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?