OneTimeCodeView 1.0.1

OneTimeCodeView 1.0.1

ANDRII_DROBIAZKO 维护。




  • Andrii Drobiazko

OneTimeCodeView

用swift编写的简单iOS库,提供了一个具有出色UX的UITextField用于.oneTimeCode

👨‍💻iOS 10+ <3 CocoaPods🦸‍♂️自动从短信中填充第二因素代码
🧙‍♀️隐藏光标
🤳易于使用

安装

  pod 'OneTimeCodeView', '~> 1.0.1'

填充代码视图

Filled view

空视图

Empty view

使用方法

@IBOutlet weak var oneTimeCodeView: OneTimeCodeView!

    override func viewDidAppear(_ animated: Bool) {
       // required:
      self.oneTimeCodeView.configure(countOfDigits: NUMBER_COUNT)
      self.oneTimeCodeView.didEnterLastDigit = { [weak self] (code) -> () in
          print(code)
          // TODO verify the code
      }
    }

    // (optional) if you want to clear OneTimeCodeView if verification fails
    func onVerificationError(error: Error) {
        self.oneTimeCodeView.clear()
        // display an error message
    }