Latest 0.1.1
Homepage https://github.com/MartinMoizard/Progressable
License MIT
Platforms ios 8.0, requires ARC

Build Status
CocoaPods Compatible

Progressable is a simple component to help you add a simple animatable progress bar to any UIView.

Usage

3 simple steps to follow:

  • make your UIView conform to the Progressable protocol.
  • call self.initProgress() in init(frame: CGRect) and init?(coder aDecoder: NSCoder).
  • call self.layoutProgress() in func layoutSubviews().

API

After conforming to the Progressable protocol, you change the progress using:

  • the progress property: self.progressView.progress = 50 (values are from 0 to 100).
  • the setProgress(progress: CGFloat, withDuration duration: TimeInterval) method.

The following properties can be customized:

  • progressLineWidth: width of the progress bar.
  • progressColor: color of the progress bar.

Example

class ProgressSearchBar: UISearchBar, Progressable {
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.initProgress()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.initProgress()
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        self.layoutProgress()
    }
}

This example can be run using Progressable.xcodeproj.

Preview

progress

Latest podspec

{
    "name": "Progressable",
    "version": "0.1.1",
    "summary": "Add an horizontal loading bar to any UIView",
    "description": "Lightweight component to create an horizontal loading line on any UIView.",
    "homepage": "https://github.com/MartinMoizard/Progressable",
    "screenshots": "https://cloud.githubusercontent.com/assets/395477/18714291/9620e9a0-8015-11e6-9552-34b2bc9b8467.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Martin Moizard",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/MartinMoizard/Progressable.git",
        "tag": "0.1.1"
    },
    "source_files": "Progressable/**/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This