Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strong password overlay on UITextField

I faced with strange overlay on UITextField. I'm using field of type textContentType = .password and isSecureTextEntry = true. I have also eye button to unhide password characters with changing isSecureTextEntry = false.

When I do that my password characters are visible, but when I type at least one new character Strong password overlay appears and it's no way to hide it.

What is that and how to prevent to show it?

strong password overlay

// EDIT:

I've made extension to disable AutoFill and it's works:

extension UITextField {
    func disableAutoFill() {
        if #available(iOS 12, *) {
            textContentType = .oneTimeCode
        } else {
            textContentType = .init(rawValue: "")
        }
    }
}
like image 755
DennyDog Avatar asked Nov 20 '19 10:11

DennyDog


1 Answers

Found the only solution for this problem.

textField.textContentType = .oneTimeCode

Otherwise iOS 12 uses PasswordAutofill for any secure field (textField.isSecureTextEntry = true).

This solution is from apple developer forum Yuri Petukhov' answer.

like image 155
DarkHorse Avatar answered Oct 31 '22 20:10

DarkHorse