Username/password autofill on UITextField only fills out the selected custom view conforming to UITextInput

60 Views Asked by At

I've been fiddling with autofill for my signup flow on iOS, and I can't seem to get it to work perfectly.

I have a custom view that has a UITextField as one of the properties and I build all my text fields as instances of that custom view.

When I first made it, I didn't know I was supposed to conform to UITextInput to make autofill work, but autofill already almost worked great on everything except when textContentType = .newPassword. What was working was that I could tap the password manager when logging in and iOS would fill out BOTH the username & password fields for me, EXCEPT for the .newPassword field which didn't work at all or fill new passwords.

When I conformed to UITextInput, the .newPassword text field kinda worked in that it would let me open the password manager...however, all text fields now only fill out the selected UITextField, and never any other one. Ahhh I thought I had it!

This is far from desirable, since a user could create a password and only the username would be filled out, or vice versa. Plus, when logging in, you have to enter your password manager twice for the username + password.

Any tips for making this work? Thank you!

PS - It seemed that conforming to UITextInput was just boilerplate code anyway since I was already using a UITextField but just wrapped in a parent UIView...which was confusing but alright.

0

There are 0 best solutions below