A library that provides counter label component for iOS

CharacterCounter

A library that provides counter label component that can be added to as a subview to a view or used as a keyboard accessory view.

Example

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

Requirements

Installation

CharacterCounter is available through CocoaPods and Carthage.

CocoaPods

  1. Add a pod entry for CharacterCounter to your Podfile pod 'CharacterCounter', '~> 1.0'
  2. Install the pod(s) by running pod install.
  3. Include CharacterCounter wherever you need it with #import CharacterCounter".

Carthage

  1. Add CharacterCounter to your Cartfile. e.g., github "javalnanda/CharacterCounter" ~> 1.0
  2. Run carthage update
  3. Follow the rest of the standard Carthage installation instructions to add CharacterCounter to your project.

Usage

You can use this component as a keyboard accessory view or add as a subview to view whatever suits your requirement.
Refer to the examples in ViewController file in CharacterCounterExample folder.

The component handles the delegate for textfield/textview. If you wish to manage it yourself for updating button states or any other requirements based on text changes, you can simply implement the delegates in your viewcontroller and call updateCharacterCount() method of the component to update the counter text.

GitHub