- April 27, 2024
- Mins Read
A custom TextField with a switchable icon which shows or hides the password and enforces good password policies, written in Swift
.
You can use CocoaPods to install PasswordTextField
by adding it to your Podfile
:
platform :ios, ‘8.0’
use_frameworks!
pod ‘PasswordTextField’
To get the full benefits import PasswordTextField
wherever you import UIKit
import UIKit
import PasswordTextField
Create a Cartfile
that lists the framework and run carthage bootstrap
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/PasswordTextField.framework
to an iOS project.
github “PiXeL16/PasswordTextField”
NOTE: These instructions are intended for usage on Xcode 11 and higher. Xcode 11 is the first version of Xcode that integrates Swift Package Manager and makes it way easier to use than it was at the command line. If you are using older versions of Xcode, we recommend using CocoaPods.
PasswordTextField
repo on GitHub (https://github.com/PiXeL16/PasswordTextField.git) into the search bar, then hit the Next button:PasswordTextField
library and then hit finish.
/PasswordTextField
folder in your project.UITextField
to a ViewController.UITextField
to PasswordTextField
and the module to PasswordTextField
.Property name | Data type | Remark |
---|---|---|
Show Toggle Button While | String | Possible values are editing (default), always , never |
Image Tint Color | UIColor | The color off the Toggle image, the functionality use UIImageRenderingMode.AlwaysTemplate to change the default or custom image color |
Custom Show Secure Text Image | UIImage | Your custom image to show the secure text |
Custom Hide Secure Text Image | UIImage | Your custom image to hide the secure text |
PasswordTextField
also provides functionality to enforce good password policies.
It will currently validate that the password format is at least 8 characters long and contain one uppercase letter and one number
.
import PasswordTextField
if passwordTextField.isInvalid(){
print(passwordTextField.errorMessage)
}
You can also provide your custom password validation format (with Regex) and error message:
import PasswordTextField
let validationRule = RegexRule(regex:”^[A-Z ]+$”, errorMessage: “Password must contain only uppercase letters”)
passwordTextField.validationRule = validationRule
if passwordTextField.isInvalid(){
print(passwordTextField.errorMessage)
}
Horizon SDK is a state of the art real-time video recording / photo shooting iOS library. Some of the features ...