Latest 1.0.1
Homepage https://github.com/crocode-mobi/CROCOValidationForms
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation
Authors ,

Introduction

Simple Objective C category to validate strings formats. You can use it to validate forms.

Installation

Cocoapods

Install Cocoapods if need it

$ gem install cocoapods

Add CROCOValidationForms in your Podfile

pod 'CROCOValidationForms'

Then, run the following command

$ pod install

Manual

Copy CROCOValidationForms.h and CROCOValidationForms.m to your project. That’s it.

Usage

It’s is very easy. Just use it like a new feature of a NSString. They return true or false.

Methods


- (BOOL) validateEmail;

- (BOOL) validationBlank;
+ (BOOL) validationBlankForStrings:(NSArray *)strings;

- (BOOL) validatePassWithMinLength:(NSInteger)minLength;
- (BOOL) validatePassWithMinLength:(NSInteger)minLength withAtLeastOneCharacter:(BOOL)character andAtLeastOneDigit:(BOOL)digit;

Example Code

- (IBAction)actionCheck:(id)sender {
    NSString *email = self.textFieldEmail.text;
    NSString *pass  = self.textFieldPass.text;

    if (![email validationBlank] || ![pass validationBlank]) {
        [self showAlertWithDescription:@"Can't be blank"];
    }
    else if (![email validateEmail]) {
        [self showAlertWithDescription:@"Wrong email format"];
    }
    else if (![pass validatePassWithMinLength:4 withAtLeastOneCharacter:true andAtLeastOneDigit:true]) {
        [self showAlertWithDescription:@"Pass should have at least 4 characters, at least 1 char and at least 1 digit"];
    }
    else {
        [self showAlertWithDescription:@"Everything is ok"];
    }
}

Latest podspec

{
    "name": "CROCOValidationForms",
    "version": "1.0.1",
    "summary": "CROCOValidationForms is a Objective C category developed by CROCODE team to validate strings forms",
    "description": "  CROCOValidationForms is a Objective C category developed by CROCODE team to validate strings forms. We usually use this category with the uitextfield content.n",
    "homepage": "https://github.com/crocode-mobi/CROCOValidationForms",
    "license": "MIT",
    "authors": {
        "pb.ojeda": "[email protected]",
        "robmarco": "[email protected]"
    },
    "source": {
        "git": "https://github.com/crocode-mobi/CROCOValidationForms.git",
        "tag": "1.0.1"
    },
    "social_media_url": "https://twitter.com/CrocodeMobile",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "CROCOValidationForms": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": "Foundation"
}

Pin It on Pinterest

Share This