Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

stockx/CountableLabel

Repository files navigation

Countable Label Logo

Swift4.0 Platform Version License

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

CountableLabel is a UILabel that was heavily inspired by GCountableUILabel. This subclass will provided a variety of nice text setting animations especially when the label is used for dynamic number changes. The reason we built our own version of GCountableUILabel is because the original repo was written in Objective-C, on top of that decrementing/setting of different size text cause a lot of breaking in the pod. With the new version you are free to change the text to what ever you choose! Happy Counting!

Contents

  1. Features
  2. Usage
  3. Installation
  4. License
  5. Contact
  • Works with all devices running iOS 9+.
  • Override text internally to keep the usage extremely simple.
  • 3 types of animations (PushUp, PushDown, Fade) and a feature have no animation as well.
  • Works with autolayout, honors intrinsic sizing, and self sizes on the fly.
  • Works with labels created in code and in Interface Builder.
  • Example app with lots of real-time configurations that lets you dynamically increment/decrement a value of your choosing, specify which animation you want to use, and specify text alignment of the label!

Set up

Swap any UILabel with CountableLabel:

In code


Before:
class ViewController {
let label = UILabel()
}
After:
import CountableLabel

class ViewController {
let label = CountableLabel()
}

In Interface Builder


Before:

Interface Builder Screenshot - Before

After:

Interface Builder Screenshot - After

Animation Type

Set label.animationType = .pushUp to see text go bottom up across the label.

PushUp Animation Demo

Set label.animationType = .pushDown to see text go top down across the label.

PushDown Animation Demo

Set label.animationType = .fade to see text fade in and out on the label.

Fade Animation Demo

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate CountableLabel into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'CountableLabel'

Then, run the following command:

$ pod install

In case Xcode complains ("Cannot load underlying module for CountableLabel") go to Product and choose Clean (or simply press K).

Manually

If you prefer not to use CocoaPods, you can integrate CountableLabel into your project manually.

CountableLabel is developed by Andrew Foghel at StockX and is released under the MIT license. See the LICENSE file for details.

Feel free to email me (at [email protected]). If you find any problems with the project or have ideas to enhance it, feel free to open a GitHub issue and/or create a pull request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published