Latest 0.4
Homepage https://github.com/Khmelevsky/QuickForms
License MIT
Platforms ios 8.0, tvos 9.0, requires ARC
Authors

CocoaPods
CocoaPods
CocoaPods
CocoaPods
CocoaPods

The Basics

Create form model

class AuthorizationForm: Form {

    let email = Field<String>()
        .add(filter: Filters.Trim())
        .add(validator: Validators.Required())
        .add(validator: Validators.Email())

    let password = Field<String>()
        .add(filter: Filters.Trim())
        .add(validator: Validators.Required())

    let code = Field<Int>()

    override func elements() -> [Element] {
        return [email, password, code] + super.elements()
    }

}

bind form to UI element

class ViewController: UIViewController {

    let form = AuthorizationForm()

    override func viewDidLoad() {
        super.viewDidLoad()

        // bind variables
        form.email.bind(to: emailTextField)
        form.password.bind(to: passwordTextField)
        form.code.bind(to: codeTextField)
    }

}

validation and getting result

if form.isValid() {
    form.email.value()
    form.password.value()
    form.code.value(default: 3483)
} else {
    //form.errors
}

Custom Filter

to do

Custom Validator

to do

Custom Element

to do

Installation

Cocoapods

QuickForms can be added to your project using CocoaPods 0.36 or later by adding the following line to your Podfile:

pod 'QuickForms'

License

QuickForms is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "QuickForms",
    "version": "0.4",
    "summary": "Quick forms",
    "homepage": "https://github.com/Khmelevsky/QuickForms",
    "authors": {
        "Alexandr Khmelevsky": "[email protected]"
    },
    "social_media_url": "https://twitter.com/AlexKhmelevsky",
    "source": {
        "git": "https://github.com/Khmelevsky/QuickForms.git",
        "tag": "0.4"
    },
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "requires_arc": true,
    "source_files": "Sources/**/*.swift",
    "license": "MIT",
    "pushed_with_swift_version": "4"
}

Pin It on Pinterest

Share This