iOS 11 disable password autofill accessory view option?

后端 未结 20 2542
孤独总比滥情好
孤独总比滥情好 2020-11-28 04:20

As of now I would like to opt out of the new option iOS 11 gives, that is to suggest passwords in the app. When I run the app on iOS 11 I get the autofill option on top of t

20条回答
  •  感动是毒
    2020-11-28 04:41

    Crazy staff happening in this topic. I've made without iOS proposing me a password, but given me an autofill for email only. Just if someone need it so. After different combinations and different type of textContentType I've made it as I wanted.

    1. Email Text field with iOS autofill proposing be something.
    2. Password text field with no iOS system proposing me a new password, but filling it with password if I choose it from email text field.
    3. Password text field to have secure entry text.

    And with this code it worked. Doesn't matter if you have email or username it will make you a proposition with what you need. So I've disabled accessory autofill view and left only autofill in toolbar of keyboard.

    self.passwordField.isSecureTextEntry = true
    
    if #available(iOS 11.0, *) {
        self.emailField.textContentType = .username
        self.emailField.keyboardType = .emailAddress
    }
    
    if #available(iOS 12.0, *) {
        self.passwordField.textContentType = .password
        self.passwordField.keyboardType = .default
    }
    

提交回复
热议问题