DigitInputView icon indicating copy to clipboard operation
DigitInputView copied to clipboard

Using OneTimeCode with DigitInputView Crashes app

Open iTatla1 opened this issue 6 years ago • 2 comments

When using iOS12 oneTimeCode feature on digit-input-view it crashes app, here's how I'm doing it.

 func setupDigitView(){
        digitView.numberOfDigits = 4
        digitView.bottomBorderColor = AppTheme.placeholderColor ?? UIColor.white
        digitView.nextDigitBottomBorderColor = AppTheme.placeholderColor ?? UIColor.white
        digitView.textColor = UIColor.white
        digitView.acceptableCharacters = "0123456789"
        digitView.keyboardType = .decimalPad
        digitView.animationType = .spring
        digitView.font = UIFont.monospacedDigitSystemFont(ofSize: 10, weight: UIFont.Weight(rawValue: 1))
        digitView.keyboardAppearance = .dark
        
        // One time code
        if #available(iOS 12.0, *) {
            for view in digitView.subviews{
                guard let tf = view as? UITextField else{continue}
                tf.textContentType = .oneTimeCode
            }
        }
    }


And the crash is : screenshot 2018-12-31 at 9 51 57 pm screenshot 2018-12-31 at 9 51 36 pm

Fatal error: Can't remove last element from an empty collection

iTatla1 avatar Dec 31 '18 16:12 iTatla1

Same issue

boranyldrm avatar Feb 04 '19 19:02 boranyldrm

@boranyldrm I've fixed this issue you can check the solution on following https://github.com/iTatla1/DigitInputView.git repo

iTatla1 avatar Feb 08 '19 10:02 iTatla1