Giter Club home page Giter Club logo

apvalidators's Introduction

APValidators

APValidators

Build Status codecov.io Version License Platform

Form validation without any code!

APValidators is a codeless solution for form validation. Just connect everything right in Interface Builder and you're done. Supports really complex and extendable forms by allowing to connect validators in tree.

Features

  • Tree structure for validation rules.
  • No need for any inheritance in UI classes. This means you can use any UITextField or UITextView subclasses and still use APValidators.
  • Easy to integrate to any codebase.
  • Perfect unit tests code coverage.

Usage

  1. Create your form UI in Interface Builder.

  2. In Interface builder add Object Object to your UIViewController for every validator.

    Validators

  3. Assign custom class for every validator.

    • APRegexValidator - validates over regex expression.
    • APRequiredValidator - validates that string is not empty.
    • APZipValidator - ZIP code validation. Must have two-letters country code assigned. Currently supports 151 countries.
    • APEmailValidator - email validation.
    • APEqualValidator - validates that two controls has equal text.
    • APBlockValidator - invokes custom block for validation.
    • APCreditCardValidator - validates credit card number by Luhn alghoritm. Also returns credit card type.
    • APCharactersCountValidator - validates lenght of string by min and max characters count.
    • APCompoundValidator - allows to connect child validators. Will have valid state only if every child validator has valid state. Also returns errorMessages array of all not valid child validators errorMessage properties at the moment.

    Assign subclass

  4. Connect your UI-control validator property to validator Object. APValidators currently support only UITextField and UITextView subclasses.

    Connect validator

  5. Use APCompoundValidator if you need more than one validator for UI-control. Connect it to UI-control and all validators to it's validators property.

    Compound validator

  6. Use one APCompoundValidator as form validator and connect all other validators to it.

    Form validator

Example

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

Requirements

  • iOS 8.0 and higher
  • ARC

Installation

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

pod 'APValidators'

Author

Nickolay Sheika, [email protected]

Contacts

If you have improvements or concerns, feel free to post an issue and write details.

Check out all Alterplay's GitHub projects. Email us with other ideas and projects.

License

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

apvalidators's People

Watchers

 avatar

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.