Search code examples
iosswiftstoryboarduitextfield

isSecureTextEntry Password TextField causes an error in displaying keyboard tips


I'm working with some UITextFields to use the Email field and the Password field.

In the Password field I entered isSecureTextEntry = true In the Email field I have suggestions for the user's email

Since I entered isSecureTextEntry in the password head, the suggestions in the Email field no longer appear

Have you also had this problem? is there a way to solve it?

Thank you all

if I change isSecureTextEntry from true to false ... everything works correctly ... I don't understand


EMAIL BEFORE TAP ON PASSWORD TEXTFIELD EMAIL AFTER PASSWORD TEXTFIELD TAPPED


Solution

  • The behaviour you are seeing is by design.

    Note that in the second instance iOS is showing the "Password" button to access keychain passwords.

    When iOS detects a username and password field pair it offers saved usernames/passwords rather than previously used emails on the basis that this is probably more useful.

    If you set the secure text field content type to "new password" then iOS will infer that this is an account creation screen and will not offer saved passwords, but in my opinion this is a worse user experience.