Latest 0.4.1
Homepage https://github.com/mac-gallagher/MGSegmentedProgressBar
License MIT
Platforms ios 9.0
Authors

Swift-Version
CocoaPods
license
CocoaPods

An animatable progress bar with support for multiple sections.

ProgressBar


Requirements

  • iOS 9.0+
  • Xcode 10.0+
  • Swift 4.2+

Installation

CocoaPods

MGSegmentedProgressBar is available through func numberOfSteps(in progressBar: MGSegmentedProgressBar) -> Int func numberOfSections(in progressBar: MGSegmentedProgressBar) -> Int func progressBar(_ progressBar: MGSegmentedProgressBar, barForSection section: Int) -> MGBarView

  • Done!
  • The progress of each section can be changed by calling any of the following functions:

    func setProgress(forSection section: Int, steps: Int) //sets the progress
    func advance(section: Int, by numberOfSteps: Int = 1) //advances the existing progress 
    func resetProgress() //sets the progress of all sections to zero

    Architecture

    There are two major components in the MGSegmentedProgressBar framework. The first is the MGSegmentedProgressBar which displays the individual bar sections. It is responsible for maintaining the overall progress and controlling the width of each bar. The second component are the bar sections themselves.

    MGSegmentedProgressBar

    Each MGSegmentedProgressBar exposes the following variables:

    var dataSource: MGSegmentedProgressBarDataSource?
    
    var cornerRadius: CGFloat = 0
    var borderWidth: CGFloat = 0
    var borderColor: UIColor? = .black
    var lineCap: LineCapType = .round 
    
    var barInset: CGFloat = 0
    var barBackgroundColor: UIColor? = .white
    var barBorderColor: UIColor? = .black
    var barBorderWidth: CGFloat = 0
    var barTitleLabel: UILabel?
    var barTitleEdgeInsets: UIEdgeInsets = .zero
    var barTitleAlignment: AlignmentType = .center

    Animating your progress

    All of methods which change the progress can easily be animated. For example,

    UIView.animate(withDuration: 0.2) {
        self.progressBar.setProgress(forSection: 0, steps: 4)
    }
    

    ProgressBarSection

    Each ProgressBarSection exposes the following variables:

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

    Author

    Mac Gallagher, [email protected]

    License

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

    Latest podspec

    {
        "name": "MGSegmentedProgressBar",
        "version": "0.4.1",
        "platforms": {
            "ios": "9.0"
        },
        "summary": "An animatable progress bar with support for multiple sections",
        "description": "An animatable progress bar with support for multiple sections.",
        "homepage": "https://github.com/mac-gallagher/MGSegmentedProgressBar",
        "screenshots": [
            "https://raw.githubusercontent.com/mac-gallagher/MGSegmentedProgressBar/master/Images/progress_bar.gif"
        ],
        "documentation_url": "https://github.com/mac-gallagher/MGSegmentedProgressBar/tree/master/README.md",
        "license": {
            "type": "MIT",
            "file": "LICENSE"
        },
        "authors": {
            "Mac Gallagher": "[email protected]"
        },
        "source": {
            "git": "https://github.com/mac-gallagher/MGSegmentedProgressBar.git",
            "tag": "v0.4.1"
        },
        "swift_version": "4.2",
        "source_files": "MGSegmentedProgressBar/Classes/**/*"
    }

    Pin It on Pinterest

    Share This