Latest 0.1.0
License MIT
Platforms ios 6.0, requires ARC

JAMValidatingTextField adds validation facilities to UITextField in iOS, solving the problem of how to visually indicate that a text field’s contents are valid to the user.

It extends the basic UITextField to have three different validation states; valid, invalid, and indeterminate. Validation is applied by either setting a built-in validation type (email, URL, phone, or zip code) or by assigning a validation block, an NSRegularExpression, or good old delegate.

The visual feedback by default shows an indeterminate text field with a gray outline and gray dash. An invalid text field has a red outline and red X, and a valid text field has a green outline and green checkmark. Empty text fields are considered "indeterminate" unless isRequired is set to YES.

The visuals are generated programmatically so the class is totally self contained. All you need is the .h and .m files.

example image

Example of setting validation to a built-in type:

self.emailTextField.validationType = JAMValidatingTextFieldTypeEmail;

Example of validating using a block:

self.blockTextField.validationBlock = ^{
    if (self.blockTextField.text.length == 0) {
        return JAMValidatingTextFieldStatusIndeterminate;
    if (self.blockTextField.text.length > 5) {
        return JAMValidatingTextFieldStatusValid;
    return JAMValidatingTextFieldStatusInvalid;

Example of validating using the delegate protocol:

- (JAMValidatingTextFieldStatus)textFieldStatus:(JAMValidatingTextField *)textField;
    if (textField.text.length == 0) {
        return JAMValidatingTextFieldStatusIndeterminate;
    return [textField.text rangeOfString:@"P"].location != NSNotFound;

Example of validating using an NSRegularExpression:

self.regexTextField.validationRegularExpression = [NSRegularExpression regularExpressionWithPattern:@"[0-9]{5}" options:0 error:nil];
self.regexTextField.required = YES;

Latest podspec

    "name": "JAMValidatingTextField",
    "version": "0.1.0",
    "summary": "JAMValidatingTextField adds validation facilities to UITextField in iOS.",
    "description": "JAMValidatingTextField is a class that extends UITextField and adds validation facilities including validation types and visual feedback.n nYou can either set a type (email, URL, phone, zip, etc.) or set a property to validate via block, NSRegularExpression, or delegate.n nThe text field will provide visual feedback indicating wheter it's in a valid, invalid, or indeterminate state.n",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Jeff Menter": "[email protected]"
    "platforms": {
        "ios": "6.0"
    "requires_arc": true,
    "source": {
        "git": "",
        "tag": "0.1.0"
    "source_files": [
    "exclude_files": "Classes/Exclude"

Pin It on Pinterest

Share This