Skip to content

SimformSolutionsPvtLtd/SSFloatingLabelTextField

Repository files navigation

Platform Swift Version License PRs Welcome

SSFloatingLabelTextField

SSFloatingLabelTextField is a small library for iOS which supports Floating labels and errors with different kind of validations. Also user can add/customise own validation and error messages.

Alt text

Features!

Main Features include :-

  • Floating Placeholder label
  • Set different validations type
  • Set Custom regex for validation or for phone number formatter
  • Check if text is valid or not and display error message

All Attributes :-

Attribute Description
floatingLabelText Floating Placeholder label
selectedLabelColor Color of Floating label when textfield is active
unSelectedLabelColor Color of Floating label when textfield is active
errorText Error message when text is not valid
errorTextColor Color in which error message is shown
type Set Validation type
customValidationRegex Set Custom Regex for Validation
isPasswordToggleEnable Toggle show hide password
showPasswordImage Toggle image when password is visible
hidePasswordImage Toggle image when password is visible

Requirements

- iOS 11.0+
- Xcode 11+

Installation

CocoaPods

  • You can use CocoaPods to install SSFloatingLabelTextField by adding it to your Podfile:

     use_frameworks!
     pod 'SSFloatingLabelTextField'
    
  • Import SSFloatingLabelTextField in your file:

     import SSFloatingLabelTextField
    

    Manually - Download and drop SSFloatingLabelTextField/Sources folder in your project. - Congratulations!

Usage example

In the storyboard add a UITextField and change its class to SSFloatingLabelTextField

Import SSFloatingLabelTextField

    import SSFloatingLabelTextField

Set text type in your View Controller file :-

    @IBOutlet weak var txtUsername: SSFloatingLabelTextField! // Add IBOutlet
    txtEmail.type = .email // Assign type as email
    txtPassword.type = .password(passwordRule: .medium) // Assign type as password 
    txtPhoneNumber.type = .phoneNumber(formatterString: nil) // Assign type as phone number (Params :- Phone number formatter default :- XXX-XXX-XXXX )

Check if given text field is valid or not :-

    txtUsername.isValid()

Find this library useful? ❤️

Support it by joining stargazers for this repository. ⭐

🤝 How to Contribute

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪

Check out our Contributing Guide for ideas on contributing.

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

Meta

  • This project is licensed under the MIT License - see the LICENSE file for details