SmartText

1.0.5

Swift library that provides a set of useful text formatting and validation tools that can be useful in your project
NikSativa/SmartText

What's New

1.0.5

2024-04-18T15:27:44Z

Full Changelog: 1.0.4...1.0.5

SmartText

Swift library that provides a set of useful text formatting and validation tools that can be useful in your project. 'SmartTextField' is wrapping UITextField to use that powerfull tools and make it easy to use. It handles text formatting, validation, error messages and correct position of cursor when formatting text. UITextField events can be handled by 'Smart' closures in 'SmartTextField.Eventier'.

let email = SmartTextField()
let emailConfig: SmartTextField.Configuration
emailConfig = .init(placeholder: "Email",
                    textFormatter: [
                        .email,
                        .stripLeadingAndTrailingSpaces
                    ],
                    textValidator: [
                        .notEmpty(errorText: "Email is required"),
                        .email(errorText: "Invalid email format")
                    ],
                    textContentType: .emailAddress,
                    keyboardType: .emailAddress)
email.configure(with: emailConfig)

let password = SmartTextField()
let passwordConfig: SmartTextField.Configuration
passwordConfig = .init(placeholder: "Password",
                       textFormatter: .stripLeadingAndTrailingSpaces,
                       textValidator: [
                           .notEmpty(errorText: "Password is required"),
                           .includesLowerAndUppercase(errorText: "Password must contain lower and uppercase characters"),
                           .minLengthLimited(8, errorText: "Password must be at least 8 characters long")
                       ],
                       textContentType: .emailAddress,
                       keyboardType: .emailAddress)
password.configure(with: passwordConfig)

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 04:55:33 GMT-0900 (Hawaii-Aleutian Daylight Time)