CHCountingLabel 1.0.1

CHCountingLabel 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Calvin Huang.




  • By
  • Calvin

CHCountingLabel

Snapshot

snapshot1 snapshot2

About

CHCountingLabel has not only function to do basic counting.
It also can speeding up or slowing down counting.
Use CHCountingLabel to bring more awesome effect for your app.

Usage

CHCountingLabel is very simple to use.

  • Basic counting - Decrease numbers per second
@IBOutlet weak var countingLabel: CountingLabel!

    override func viewDidLoad() {
        super.viewDidLoad()

        countingLabel.textFormatter = { (value: Double) -> String in
            return "\(Int(value))"
        }
        countingLabel.startValue = 50
        // Default stop value is 0.
        // coutingLabel.stopValue = 0
    }

    @IBAction func startCountingButtonClicked(_: AnyObject) {
        countingLabel.start()
    }

    @IBAction func pauseCountingButtonClicked(_: AnyObject) {
        countingLabel.pause()
    }

    @IBAction func stopCoutingButtonClicked(_: AnyObject) {
        countingLabel.stop()
    }
  • Basic counting - Increase numbers per second
countingLabel.startValue = 0
countingLabel.stopValue = 50
  • Counint seed up and slow down depends on given bezier path.
countingLabel.easing = CubicBezier.Easing.EaseInOut
countingLabel.duration = 5
countingLabel.startValue = 50
// countingLabel.stopValue = 100

Migrate to Objective-C project

Accorading Apple's document, you need to Update import statements in your Objective-C code (to #import "ProductModuleName-Swift.h").

#import "CHCountingLabel-Swift.h"
// or
@import "CHCountingLabel.h"

All done! Start to use CHCountingLabel!

License

Copyright © Calvin Huang. This software is licensed under the MIT License.