Disable password autofill iOS 12

I have a view with a signle UITextField in it. When the secure text entry is enabled the password autofill appears on the soft keyboard on iOS 12. I have tried changing the content type of the UITextField to values other than username or password (i.e. nickname, city) but password autofill still appears. Is there a way to disable password autofill on iOS 12? I am using XCode 10.0 beta 6 & iOS 12 Beta 10.

Post not yet marked as solved Up vote post of platons Down vote post of platons
11k views

Replies

I am also searching for a way to disable password autofill for use cases where it is not appropriate. Changing the field's `textContentType` no longer works. I have also tried changing `secureTextEntry` to false, but that also did not work. Can someone clarify how fields are being identified as needing autofill suggestions, if `textContentType` is not it?


Xcode 10.0 b6, iOS b12

Found the only solution for this problem.


textField.textContentType = .oneTimeCode


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

This is so annoying, it interrupts my whole test flow.
I have disable the option AutoFill Passwords on Settings -> Passwords and accounts, it seem that it worked, at least on the simulator.