Latest 0.5.0
Homepage https://github.com/wachus77/TIFormInputView
License MIT
Platforms ios 9.0
Authors

GitHub license
Swift 4.2

Animation
Animation

Example

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

Installation

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

pod 'TIFormInputView'

Basic Usage

import TIFormInputView

Make an outlet or create a view programmatically and configure it.


@IBOutlet weak var email: FormInputView!
@IBOutlet weak var password: FormInputView!

override func viewDidLoad() {
    super.viewDidLoad()
    hideKeyboardWhenTappedAround()

    let emailRegex = "[A-Z0-9a-z._%+-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,64}"
    let emailPlaceholder = "email"
    let emailErrorText = "please provide valid email"

    email.keyboardType = .emailAddress
    email.placeholder = emailPlaceholder
    email.regex = emailRegex
    email.error = emailErrorText

    let addtRulMin8CharRegex = "^.*(?=.{8,}).*$"
    let addtRulUpperLowerCaseRegex = "^.*(?=.*[A-Z])(?=.*[a-z]).*$"
    let addtRulOneNumeralRegex = "^.*(?=.*[0-9]).*$"

    let addtRulMin8CharText = "min 8 characters"
    let addtRulUpperLowerCaseText = "at least one upper case and one lower case"
    let addtRulOneNumeralText = "at least one numeral"

    let additionalRules = [AdditionalValidationRule(regex: addtRulMin8CharRegex, text: addtRulMin8CharText), AdditionalValidationRule(regex: addtRulUpperLowerCaseRegex, text: addtRulUpperLowerCaseText), AdditionalValidationRule(regex: addtRulOneNumeralRegex, text: addtRulOneNumeralText)]

    let passwordRegex = "^.*(?=.{8,})(?=.*[A-Z])(?=.*[0-9])(?=.*[a-z]).*$"
    let passwordPlaceholder = "password"
    let passwordErrorText = "please provide valid password"

    password.isSecuredTextEntry = true
    password.placeholder = passwordPlaceholder
    password.regex = passwordRegex
    password.error = passwordErrorText
    password.initAdditionalValidationRules(additionalRules: additionalRules)
}

Author

Tomasz Iwaszek, [email protected]

License

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

Latest podspec

{
    "name": "TIFormInputView",
    "version": "0.5.0",
    "summary": "Extended input view for the form with additional validation (step-by-step) and error handling.",
    "swift_version": "4.2",
    "description": "Extended input view with animated title, text field, error text and additional fields to indicate whether the individual validation steps have been met.",
    "homepage": "https://github.com/wachus77/TIFormInputView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tomasz Iwaszek": "[email protected]"
    },
    "source": {
        "git": "https://github.com/wachus77/TIFormInputView.git",
        "tag": "0.5.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "TIFormInputView/Classes/**/*",
    "resource_bundles": {
        "TIFormInputView": [
            "TIFormInputView/Classes/**/*.{xib,xcassets,json,imageset,png}"
        ]
    }
}

Pin It on Pinterest

Share This