4

I want to use the new iOS 12 keyboard feature for auto generating strong passwords for our users.

In the signup progress, the password field appears on its own viewcontroller which only triggers saved password.

Inserting an textfield with textContentType .userName above the password field fixes the problem.

Does anyone know how to generate strong password when only one textfield (passwordField) on the viewcontroller?

I tried both setting the textContentType to .newPassword in code and storyboard

Thank you!

PAK
  • 431
  • 4
  • 17

1 Answers1

2

Both components are necessary for Apple's logic to detect that you are setting a new password and to be able to save the correct username, password pair in the keychain.

I had the exact same case and how I solved it is that I did add the .username field, but behind other view elements - so it does not appear on the screen but it is in the view hierarchy. I did try to make it hidden but this does not work.

I put mine outside the screen on the very top.

enter image description here

Having the .username field in the view hierarchy will make the strong password suggestion to work.

Hope it helps!

Catalina T.
  • 3,456
  • 19
  • 29