I've added 3 UITextFields
to create a new account by entering a username in email address format, a new password and a password confirmation. As suggested in Enabling Password AutoFill on a Text Input View. I have configured the username field like this
userTextField.textContentType = .username
userTextField.keyboardType = .emailAddress
and the new password fields like this
newPasswordTextField.textContentType = .newPassword
confirmPasswordTextField.textContentType = .newPassword
Now, when the users enters an email address as username the newPasswordTextField
is pre-filled with a suggestion for a strong password (as expected), but the confirmPasswordTextField
isn't filled with the same suggested password.
When the user directly taps into the newPasswordTextField
without entering a username before both newPasswordTextField
and confirmPasswordTextField
are pre-filled with the same suggested password (also as suggested).
How can i combine this both situations that after the user enters a username both password fields will be pre-filled with the same password?
Note: In order for iPhone to create and store passwords, iCloud Keychain must be turned on. Go to Settings > [your name] > iCloud > Passwords and Keychain.
iOS 14 or later: Go to Settings > Passwords > AutoFill Passwords. Check that AutoFill Passwords is turned on. iOS 12 or 13: Go to Settings > Passwords & Accounts > Website & App Passwords. Check that AutoFill Passwords is turned on.
Setting up autofill on Android 8.0 and later versions On your Android device tap Settings — General Management — Language and input. Note: The location of this setting may differ from one Android device to another. Select Sticky Password as your Autofill service. Tap OK to indicate you trust Sticky Password.
I was able to do autocomplete for 2 password fields by declaring the contentType
of the first field as: .password
.username
.password
.newPassword
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With