APValidators - Codeless solution for form validation in iOS!

Overview

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.

Comments
  • Carthage Support

    Carthage Support

    • Added Carthage support #1

    @hawk-ukr please review changes.

    I apologize for the large number of files changed. While this may seem odd at first if you scroll through you'll notice I actually didn't change much. I updated the APValidators library using CocoaPods newest pod lib create **** command available with CocoaPods 1.1.1. They also suggest a .gitignore setup slightly different from the one you had previously. This pushed the .xcworkspace along with the Pods directory to the repo. Most of the files changes are these additions. You'll see I also updated the README.md to reflect installing via Carthage. I bumped the version in the .podspec but did not push a tag for release. I figured I'd leave that up to you.

    Let me know if you see any issues with the way I went about doing this but the Carthage installation does work. You can create a Cartfile and add "chrisdhaan/APValidators" "carthage-support" to test it.

    opened by chrisdhaan 6
  • Usage with Swift

    Usage with Swift

    Hi, I've been trying to use this pod in a Swift project of mine but it keeps failing to build. Should I just add APValidator.h class to my bridge header file or also each validator as well?

    opened by mradzinski 2
  • added validation support for MDTextField from Material Controls for iOS

    added validation support for MDTextField from Material Controls for iOS

    Hi,

    I've created an MDTextField category according to this issue, wrote recently: https://github.com/Alterplay/APValidators/issues/3

    Please provide some feedback, if something isn't correct.

    Best regards

    opened by emdzsi 2
  • Loading ZipRegex.plist issue

    Loading ZipRegex.plist issue

    I use library through CocoaPods. Trouble when create a path for resource NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSString *path = [bundle pathForResource:@"ZipRegex" ofType:@"plist"];

    Словарь алокейтится пустым. Решил проблему скопировав plist в основной бандл. Но это костыль. Инвестигейтить в чем проблема не стал. На первый взгляд все должно работать.

    bug 
    opened by chaserunner 1
  • Feature request: support of multiple types of text inputs

    Feature request: support of multiple types of text inputs

    Hi,

    I don't know you guys are planning this but it would be nice, if not only UIKit text inputs can be validated but other custom types. For example I'm using Material Control For iOS's MDTextField, unfortunately it's a UIControl only.

    enhancement 
    opened by emdzsi 1
  • Suggestions

    Suggestions

    Hi,

    I'm using APValidator on a project and i think my suggestions could be a good improvement, correct me if i'm wrong.

    1 - APCompoundValidator could be able to manage many outlets, for example if i have 2 password textfields it would be perfect if i just add those textfield to the same compound (right now i need to create a compound for each validator).

    2 - APRequiredValidator it would be perfect if i could add the minimum number of characters (right now APRequiredValidator only check if the string is empty.).

    3 - If i had a required validator and a email validator in the same textfield, the required validator should be a higher priority, so, if the validations pass the required validator, that means the textfield isn't empty, so i will go to another validator if exists. Now i have exactly that example with an empty string on textfield and they give the error message of email validator when they should give me a required validator message.

    Thank you for your time.

    opened by BrunoMiguens 1
  • Cannot archive in xcode 13

    Cannot archive in xcode 13

    After updating to xcode 13.0 I am facing following error:

    Unexpected duplicate tasks:
    1) Target 'APValidators' (project 'Pods') has copy command from '/Users/monica/Workspace/hla360-ios/Pods/APValidators/Pod/Classes/Private/CountryRegexLoader/ZipRegex.plist' to '/Users/monica/Library/Developer/Xcode/DerivedData/HLA-fvyquzwxtgvwbmdsuvepucjcfuzn/Build/Intermediates.noindex/ArchiveIntermediates/HLA/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/APValidators.framework/ZipRegex.plist'
    2) Target 'APValidators' (project 'Pods') has copy command from '/Users/monica/Workspace/hla360-ios/Pods/APValidators/Pod/Classes/Private/CountryRegexLoader/ZipRegex.plist' to '/Users/monica/Library/Developer/Xcode/DerivedData/HLA-fvyquzwxtgvwbmdsuvepucjcfuzn/Build/Intermediates.noindex/ArchiveIntermediates/HLA/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/APValidators.framework/ZipRegex.plist'
    

    Can you please help to resolve this issue ?

    opened by monica18p 0
  • amex cvn (cvv) = 4 digits

    amex cvn (cvv) = 4 digits

    Hi excited to try your control.

    As I was evaluating noticed the CVV validation was limited to 3 chars and amex cards carry 4 chars. Sure I can adjust the 3 to 4 in regex but in order to keep user input errors to minimum is this something I can do with a compound object? I'm not sure, I'll dig in deeper but in meantime if you get this before i come up with answer what is your recommendation? Is there a flag or something I can evaluate to adjust the field object for the cc number? ie, isAmex (then I can set set CVV validator to 4)

    enhancement 
    opened by rjpalermo1 1
  • Carthage

    Carthage

    opened by TofPlay 3
Owner
Alty
Custom Multi-Platform Digital Products
Alty
Custom Field component with validation for creating easier form-like UI from interface builder.

#YALField Custom Field component with validation for creating easier form-like UI from interface builder. ##Example Project To run the example project

Yalantis 476 Sep 1, 2022
Elegant iOS form builder in Swift

Made with ❤️ by XMARTLABS. This is the re-creation of XLForm in Swift. 简体中文 Overview Contents Requirements Usage How to create a Form Getting row valu

xmartlabs 11.6k Jan 1, 2023
The most flexible and powerful way to build a form on iOS

The most flexible and powerful way to build a form on iOS. Form came out from our need to have a form that could share logic between our iOS apps and

HyperRedink 32 Aug 15, 2022
Declarative form building framework for iOS

Formalist Swift framework for building forms on iOS Formalist is a Swift framework for building forms on iOS using a simple, declarative, and readable

Seed 159 May 25, 2022
SherlockForms - An elegant SwiftUI Form builder to create a searchable Settings and DebugMenu screens for iOS

??️‍♂️ SherlockForms What one man can invent Settings UI, another can discover i

Yasuhiro Inami 98 Dec 27, 2022
iOS Validation Library

Honour Validation library for iOS inspired by Respect/Validation. Validator.mustBe(Uppercase()).andMust(StartsWith("F")).validate("FOOBAR") ❗ If you w

Jean Pimentel 55 Jun 3, 2021
Former is a fully customizable Swift library for easy creating UITableView based form.

Former is a fully customizable Swift library for easy creating UITableView based form. Submitting Issues Click HERE to get started with filing a bug r

Ryo Aoyama 1.3k Dec 27, 2022
ObjectForm - a simple yet powerful library to build form for your class models.

ObjectForm A simple yet powerful library to build form for your class models. Motivations I found most form libraries for swift are too complicated to

jakehao 175 Nov 2, 2022
Some cells to Form a Pod

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

null 0 Nov 2, 2021
A rule-based validation library for Swift

SwiftValidator Swift Validator is a rule-based validation library for Swift. Core Concepts UITextField + [Rule] + (and optional error UILabel) go into

null 1.4k Dec 29, 2022
Declarative data validation framework, written in Swift

Peppermint Introduction Requirements Installation Swift Package Manager Usage Examples Predicates Constraints Predicate Constraint Compound Constraint

iOS NSAgora 43 Nov 22, 2022
SwiftyFORM is a lightweight iOS framework for creating forms

SwiftyFORM is a lightweight iOS framework for creating forms Because form code is hard to write, hard to read, hard to reason about. Has a

Simon Strandgaard 1.1k Dec 29, 2022
XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C.

XLForm By XMARTLABS. If you are working in Swift then you should have a look at Eureka, a complete re-design of XLForm in Swift and with more features

xmartlabs 5.8k Jan 6, 2023
Boring-example - Using boring crate from iOS application

BoringSSL example Using boring crate from iOS application. Checkout git clone gi

Alexei Lozovsky 0 Dec 31, 2021
GrouponHeader - iOS TableView Header Animation, Swift/UIKit

GrouponHeader Description: iOS TableView Header Animation Technology: Swift, UIK

James Sedlacek 8 Dec 15, 2022
Meet CRRulerControl - Customizable Control for iOS

Customizable component, created by Cleveroad iOS developers, is aimed at turning a simple ruler into a handy and smart instrument

Cleveroad 112 Oct 2, 2022
iOS validation framework with form validation support

ATGValidator ATGValidator is a validation framework written to address most common issues faced while verifying user input data. You can use it to val

null 51 Oct 19, 2022
iOS validation framework with form validation support

ATGValidator ATGValidator is a validation framework written to address most common issues faced while verifying user input data. You can use it to val

null 51 Oct 19, 2022
Custom Field component with validation for creating easier form-like UI from interface builder.

#YALField Custom Field component with validation for creating easier form-like UI from interface builder. ##Example Project To run the example project

Yalantis 476 Sep 1, 2022
Codeless manager to hide keyboard by tapping on views for iOS written in Swift

KeyboardHideManager KeyboardHideManager - codeless manager to hide keyboard by tapping on views for iOS written in Swift. Structure Features Requireme

Bondar Yaroslav 55 Oct 19, 2022