Skip to content

A readymade view to validate your OTP with custom border types.

License

Notifications You must be signed in to change notification settings

anuranBarman/ABOtpView

Repository files navigation

ABOtpView

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ABOtpView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ABOtpView'

Screenshot

Screenshot

Usage

class ViewController: UIViewController,ABOtpViewDelegate {

        override func viewDidLoad() {
            super.viewDidLoad()

            let label = UILabel(frame: CGRect(x: 0, y: 50, width:UIScreen.main.bounds.size.width, height: 60))
            label.text = "ABOtpView"
            label.font = UIFont.boldSystemFont(ofSize: 50.0)
            label.textColor = .black
            label.textAlignment = .center

            self.view.addSubview(label)

            let otpView = ABOtpView(frame: CGRect(x: 0, y: 200, width: UIScreen.main.bounds.size.width, height: 60), numberOfDigits: 6,     borderType: .ROUND, borderColor: .blue,delegate:self)
            self.view.addSubview(otpView)

            let otpView2 = ABOtpView(frame: CGRect(x: 0, y: 300, width: UIScreen.main.bounds.size.width, height: 60), numberOfDigits: 4, borderType: .SEMI_ROUND, borderColor: .red,delegate:self)
            self.view.addSubview(otpView2)

            let otpView3 = ABOtpView(frame: CGRect(x: 0, y: 400, width: UIScreen.main.bounds.size.width, height: 60), numberOfDigits: 5, borderType: .SQUARE, borderColor: .black,delegate:self)
           
           
           self.view.addSubview(otpView3)

        }

        func didEnterOTP(otp: String) {
            print(otp)
        }


}

Author

anuranBarman, [email protected]

License

ABOtpView is available under the MIT license. See the LICENSE file for more info.

About

A readymade view to validate your OTP with custom border types.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published