Giter Site home page Giter Site logo

textfieldcounter's Introduction

TextFieldCounter

UITextField character counter with lovable UX πŸ’–. No math skills required πŸ™ƒ.

Swift Version License Build Status codecov CocoaPods

Features

  • Set max length of UITextField.
  • A beautiful and animated label about the limits. Show it by ascending or descending way.
  • Haptic Feedback.
  • Easy setup with @IBInspectable.

TextFieldCounter

Requirements

TextFieldCounter Version 1.1.0 1.0.4
iOS Version 10.0+ 8.0+
Xcode Version 11.2 8

Installation

CocoaPods

You can use CocoaPods to install TextFieldCounter by adding it to your Podfile:

platform :ios, '10.0'
use_frameworks!
pod 'TextFieldCounter'

To get the full benefits import TextFieldCounter wherever you import UIKit

import UIKit
import TextFieldCounter

Manually

  1. Download and drop TextFieldCounter.swift in your project.
  2. Congratulations πŸš€

Usage example

By Inspector

  1. Set the class and configure the options.

Inspector

Programmatically

import TextFieldCounter

let frame = CGRect(x: 20, y: 80, width: 320, height: 30)
let textField = TextFieldCounter(frame: frame, limit: 20, animate: true, ascending: true, counterColor: .black, limitColor: .red)

view.addSubview(textField)
Use Delegate

Set counterDelegate and enjoy it πŸš€:

override func viewDidLoad() {
    super.viewDidLoad()
    textField.counterDelegate = self
}

func didReachMaxLength(textField: TextFieldCounter) {
    print("didReachMaxLength")
}

Next Steps

  • Add UIAppearance support
  • Add More tests
  • Add Carthage support

Contribute

We would ❀️ to see your contribution! To contribute to TextFieldCounter, check the LICENSE file for more info.

License

Distributed under the MIT license. See LICENSE for more information.

About

Created by Fabricio Serralvo – serralvo.co

Special thanks πŸ‘ to @ciceroduarte and @rogerluan

textfieldcounter's People

Contributors

ciceroduarte avatar darthpelo avatar filletofish avatar glm4 avatar jerherrero avatar rogerluan avatar serralvo avatar swarajrenghe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textfieldcounter's Issues

Create a target label to show limits

The idea is provide a way to show the information about limits in an external label, by default, we keep using internal label (as right view).

Block-Style Interaction?

Hey,

It's a matter of taste, but if I were going to use TextFieldCounter (I'm not, currently), I'd prefer a block for handling when max length is reached.

textField.onMaxLengthCrossed { overLimit in
  submitButton.isEnabled = !overLimit
}

I don't love onMaxLengthCrossed as a name, but I couldn't think of anything better right away, so if you decide to add a block handler, maybe you can think of a better name.

On that note, it seems important to have a notification on the delegate if the max limit is "unreached" as well -- for instance in the block above, to re-enable the submit button.

Use of undeclared type 'TextFieldCounter'

Hey,

Thanks for your awesome repo. I installed the latest version Installing TextFieldCounter (0.0.2)
and I imported it import TextFieldCounter however, I got this error:

screen shot 2017-05-11 at 10 33 51 am

What is the problem?!

Thanks.

chinese invalid

θΎ“ε…₯δΈ­ζ–‡ζ—Άι™εˆΆε­—η¬¦ζ— ζ•ˆοΌŒε―δ»₯无限输ε…₯,it's a bug

Pod version outdated

It seems the version in the cocoapods repo is outdated, as the class is not open.
This causes that when importing the module, the class can't actually be used.
Would be great to fix it!! In the meantime I'll work against the repo master branch.

Update readme

Update read-me to show new features.

  • Update Features list
  • Update demo image ("See how it works" gif)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.