Latest 1.0.0
Homepage https://github.com/mohit5189/MKOtpView
License MIT
Platforms ios 8.0
Authors

CI Status

Example

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

Requirements

iOS 8.0 or greater.

Installation

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

pod 'MKOtpView'

Implementation steps

  1. Create MKOtpView Object by passing frame:
    var otpView:MKOtpView!
    otpView = MKOtpView(frame: CGRect(x: 10, y: 100, width: 350, height: 50))
  2. Now you can set different properties as given below:
otpView = MKOtpView(frame: CGRect(x: 10, y: 100, width: 350, height: 50))
otpView.setVerticalPedding(pedding: 5)
otpView.setHorizontalPedding(pedding: 5)
otpView.setNumberOfDigits(numberOfDigits: 6)
otpView.setBorderWidth(borderWidth: 2.0)
otpView.setBorderColor(borderColor: UIColor.green)
otpView.setCornerRadius(radius: 2)
otpView.setInputBackgroundColor(inputBackgroundColor: UIColor.white)
otpView.backgroundColor = UIColor.lightGray
otpView.enableSecureEntries()
self.view.addSubview(otpView)
  1. Set closure to get the response as soon as all otp fields are filled, Here you can write your own logic to use the number filled.
otpView.onFillDigits = { number in
print("input number is (number)")
}
  1. Finally call render method once everything is set.
otpView.render()

Author

Mohit Kumar

License

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

Latest podspec

{
    "name": "MKOtpView",
    "version": "1.0.0",
    "summary": "MKOtpView is a library to display UIView in app for filling the OTP. Library support secure text entry and you can fully customised your view.",
    "description": "MKOtpView is a library to display UIView in app for filling the OTP. Library support secure text entry and you can fully customised your view. MKOtpView contains several methods to set font/pedding/color/border etc.",
    "homepage": "https://github.com/mohit5189/MKOtpView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "mohit5189": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mohit5189/MKOtpView.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "MKOtpView/Classes/**/*"
}

Pin It on Pinterest

Share This