Latest 1.0.0
Homepage https://github.com/kshin/InputValidators
License MIT
Platforms ios 7.0, requires ARC
Authors ,

Build Status
codecov.io

Simple Objective-C solution for text validation.

Currently available validators:

  • Required validator
  • Email validator
  • Alpha validator
  • Numeric validator
  • Length validator
  • Regex validator
  • Multiple validator

Important

The latest version 1.0.0 contains breaking changes and it is not backward compatible with previous latests version 0.3.3. In case if you need a support for pre iOS7 versions use previous latest version 0.3.3.

Requirements

  • Xcode 7.0 or higher
  • iOS 7.0 or higher
  • ARC

Installation

CocoaPods

The recommended approach for installating InputValidators is via the CocoaPods package manager.

Edit your Podfile and add InputValidators:

pod 'InputValidators'

Install into your Xcode project:

$ pod install

Open your project in Xcode from the .xcworkspace file

$ open MyProject.xcworkspace

Manual Install

All you need to do is drop InputValidators files into your project, and add #import "LKValidators.h" to the top of classes that will use it.

Example Usage

Text Validation

NSString *email = @"[email protected]"

InputValidator *validator = [LKEmailValidator validator];
NSError *error = nil;
BOOL isValid = [validator validate:email error:&error];

if (!isValid) {
  NSLog(@"%@", [error localizedFailureReason]);
}

Text Validation with multiple validators

NSString *email = @"[email protected]"

LKValidator *validator = [LKMultipleValidator validator];
validator.validators = [[LKRequiredInputValidator validator], [LKEmailInputValidator validator]];
NSError *error = nil;
BOOL isValid = [LKValidator validate:email error:&error];

if (!isValid) {
  NSLog(@"%@", [error localizedFailureReason]);
}

Roadmap

  • [ ] Documentation
  • [ ] Swift version

License

InputValidators is available under the MIT license.

Copyright © 2013-2015 Ivan Lisovyi, Denis Kotenko.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Latest podspec

{
    "name": "InputValidators",
    "version": "1.0.0",
    "summary": "Simple Objective-C solution for text validation.",
    "homepage": "https://github.com/kshin/InputValidators",
    "license": "MIT",
    "authors": {
        "Ivan Lisovyi": "[email protected]",
        "Denis Kotenko": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/kshin/InputValidators.git",
        "tag": "1.0.0"
    },
    "source_files": [
        "Sources",
        "Sources/*.{h,m}",
        "Sources/*/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This