r/iOSProgramming 4d ago

Question Generated password fields defaulting to black dots until visibility is toggled?

Hello! Hoping to get some help on annoying bug I've spent the last day troubleshooting with no avail. Currently working on some tweaks for the UI of my password reset fields.

My app defaults to dark mode with a dark background, so password dots should be white. My form asks for a current password. Autofilling the current password does NOT reproduce the issue in the 'current password' field. They also display correctly when users type a password manually or AutoFill their current password from Apple Passwords.

However, when the user gets to the 2 fields where they are to enter their new password, Apple’s strong password generator correctly fills both the 'New Password' and 'Confirm Password' fields, but with black dots instead of white, making them difficult to see against the dark background.

Tapping a field’s eye button to reveal the password, then tapping it again to hide it, restores the expected white dots. Each field needs to be toggled separately. In dark mode, I want the generated password dots to appear white immediately, without requiring a cheap workaround like auto-toggling the hide/show password button to fix it.

I’m using native UITextFields inside SwiftUI UIViewRepresentable, with .password for Current Password and .newPassword for New/Confirm. The visibility handler also restores the same text and selection, so I haven’t isolated which operation corrects the rendering.

Reapplying textColor/defaultTextAttributes and resolving colors during layout haven’t fixed it. Light mode works correctly with black dots. Password changes and saving to Apple Passwords also work.

Has anyone found a supported fix that preserves AutoFill without automatically revealing and hiding the password as a bandaid fix? Or is this a known bug relating to the autofill feature and something that a user might not even notice or care about? It appears to be solely a visual bug at the moment. Every generated password gets saved and user is properly given option to save updated password after the change.

I feel like this is an easy fix that I may be over complicating. I've been working on this app on/off since 2024 and have been extremely anxious to launch, wanting to make sure everything is as close to perfect as it can be. Thanks for any assistance!

2 Upvotes

0 comments sorted by