Skip to content

A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

License

Notifications You must be signed in to change notification settings

bharat-madept/FloatingTextField

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FloatingTextField

A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

To add into your project drag and drop the 'Source' folder into your project. if you wants to add validation with propmt error meessage then you can do like-

    // bottom line color when textfield is active
    textField.activeLineColor = UIColor.init(colorLiteralRed: 0, green: 183.0/255.0, blue: 183.0/255.0, alpha: 1.0)
    // bottom line color when textfield filled (did end editing and has text)
    textField.filledTextFieldLineColor = .darkGray
    

    // set validation rules with message (for more validation check ValidationRule file in Source folder)
    textField.validationRules = [ValidationRule.required(message: "Email is required"),
                                    ValidationRule.email(message: "Please enter a valid email.")]
                                    
    // implement the action 
    @IBAction func doneTapped(_ sender: UIButton){
    do {
           try textField.validate()
        
    }catch(let error){
        let textf = error._userInfo?["textField"] as? FloatingTextField
        textf?.showError(message: error.localizedDescription)
    }
}

About

A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages