Latest 0.1.7
License MIT
Platforms ios 11.0

UITextField Validator


UITextField Validator is a UITextField validator which can be use in different ways. So you would now focus on writing your core logic and let UITextFieldValidator handle all your field validations. For more info you can see "How to use" section bellow.


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


UITextField Validator is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'UITextFieldValidator','0.1.7'


Deployment Target should be 11.0

How it works

The validator check ContentType of your UITextField and according to ContentType it will validate text fields if ContentType is not set for your text field then it will validate according to your KeyboardType. All this take care by this lib.

How to use

import UITextFieldValidator

There are two version of validation here, one is for simple validation and second one is validation with range. Range validation will take two more input for minimum characters and the maximum characters

You can pass multiple UITextField in both methods.

Simple validation

Validator.shareInstance.textFieldValidator(textField: TextField_1,TextField_2,TextField_3...TextField_n) { (textField:UITextField, isSuccess) in
    //handle result here

With range

Validator.shareInstance.textFieldValidator(withRange: (textField: TextField_1,TextField_2,TextField_3...TextField_n, minRange: 1, maxRange: 50)) { (textField:UITextField, isSuccess) in
    //handle result here

Note : When all textfields will be validated successfully then textfield will return nil else there will be a textfield which is not validated.

With View

yourView is the view which contains all your UITextField which need to be validated

Validator.shareInstance.validate(withView: yourView) { (textFields: [UITextField]?, isValidated) in
    if isValidated {
        //[UITextField]? will be nil
        print("valid field")
        print("not valid field")
        //[UITextField]? will contaill all the non validated UITextFields


Satyendra Chauhan

[email protected]


UITextFieldValidator is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "UITextFieldValidator",
    "version": "0.1.7",
    "summary": "UITextFieldValidator is provide textfield validation.",
    "description": "UITextFieldValidation is improved validation base on you UITextField type. Now there is no need to write bunch of code for validate your textfield.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "[email protected]": "[email protected]"
    "source": {
        "git": "",
        "branch": "distribution",
        "tag": "0.1.7"
    "platforms": {
        "ios": "11.0"
    "source_files": "UITextFieldValidator/Classes/**/*",
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This