AEOTPTextField
A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.
AEOTPTextField is a simple and easy text field control written in Swift.
- [x] It can be implemented in storyboard without a single line of code.
- [x] Highly customizable without needing to write tons of custom code.
- [x] Support both portrait and landscape views.
Check out the example project to see it in action!
Preview Samples
Default |
---|
![]() |
With Border | Without Border | Clear Background |
---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Requirements
- [x] Xcode 11.
- [x] Swift 5.
- [x] iOS 10 or higher.
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
To integrate AEOTPTextField into your Xcode project using CocoaPods, specify it in your Podfile
:
Then, run the following command:
Carthage
The integration of AEOTPTextField using Carthage will be available soon.
Swift Package Manager
The integration of AEOTPTextField using Swift Package Manager will be available soon.
Usage
Code-less Storyboard Implementation
-
Add UITextField to your ViewController. Set the
Custom Class
of the UITextField to beAEOTPTextField
in the Identity Inspector. Set theModule
toAEOTPTextField
(ignore this step if you've manually added AEOTPTextField to your project).
-
Take an oultlet from the
UITextField
to yourViewController
.
Code Implementation
First:
Setup the otpDelegate and configure the AEOTPTextField
below viewDidLoad()
, do something like this:
To configure the AEOTPTextField
with a custom slots count, do something like this:
Then, Setup the AEOTPTextFieldDelegate
method. Add this extension to your ViewController
, do something like this:
You have done.
Customization
AEOTPTextField
AEOTPTextField
supports the following:
Example of Customization