Simple iOS digit input field for OTP codes
DigitEntryView is currently available either manually by cloning the project and adding DigitEntryView.swift
to your project, or you can use the Swift Package Manager (SPM).
DigitEntryView
checkbox, then click Finish and your're all set.Drag a UIView
object and set the class to DigitEntryView
(if needed set the module to DigitEntryView
too).
import DigitEntryView
let digitEntryView = DigitEntryView()
// defaults to 6
digitEntryView.numberOfDigits = 5
// optional properties
digitEntryView.spacing = 20
digitEntryView.digitColor = UIColor.black
digitEntryView.digitFont = .systemFont(ofSize: 20)
// circle digits
digitEntryView.digitCornerStyle = .circle
// set a specific corner radius for digits
digitEntryView.digitCornerStyle = .radius(15)
digitEntryView.digitBorderColor = UIColor.lightGray
digitEntryView.nextDigitBorderColor = UIColor.blue
// set the delegate to get callback for
// when a digit changes or when the digits gets filled
digitEntryView.delegate = self
func digitsDidFinish(_ digitEntryView: DigitEntryView) {
}
func digitsDidChange(_ digitEntryView: DigitEntryView) {
}
DigitEntryView is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 1 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics