Skip to content

juanfv2/ValidateIt

Repository files navigation

ValidateIt

CI Status Version License Platform

Example

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

##Use

@IBAction func actValidate(_ sender: UIButton) {

        view.endEditing(true)

        validation.errors.removeAll()

        validation.required(txtFirstName)
        validation.required(txtLastName)
        
        if !txtLastName.text!.isEmpty {
            validation.lettersSpaceOnly(txtLastName)
        }
        
        validation.required(txtEmail)
        
        
        if !txtEmail.text!.isEmpty {
            validation.email(txtEmail)
        }

        validation.required(txtPassword)

        if !txtPassword.text!.isEmpty {
            validation.minLength(6, textField: txtPassword)
        }
        
        validation.required(txtConfirmPassword, msgError: "Confirm the password")
        
        if !txtPassword.text!.isEmpty && !txtConfirmPassword.text!.isEmpty {
            validation.textField(txtPassword, equalTotextField: txtConfirmPassword, msgError: "Passwords no match.")
        }

        print("\(self.classForCoder) \(#function) \(#line)- validation: \(validation.errors)")

        if validation.isValid() {

            lblErrors.text = " Validated "
            lblErrors.backgroundColor = .blue

        } else {

            lblErrors.text = validation.errors.joined(separator: "\n")
            lblErrors.backgroundColor = .red

        }
    }

Requirements

Installation

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

pod "ValidateIt"

Author

Juan Villalta, [email protected]

License

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

About

Validation of TextFields on iOS apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published