Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

UITextField with isSecureTextEntry in Catalyst display an empty box

Hi,

In a Mac Catalyst app, I need to allow the user insert a passcode using a UITextField.

The field is used to insert a one time passcode and I want to keep the content hidden. For this reason I set the isSecureTextEntry property to true.

passcodeTextField.isSecureTextEntry = true

By doing this, a button to allow the user to pick a password from the keychain is displayed:

This option in my case should not appear because the password is a one time password that change every time. For that reason I set the textContentType to oneTimeCode.

passcodeTextField.textContentType = .oneTimeCode

This actually removes the password button, but introduce something weird. If the user type something and then delete everything, a big empty box appear under the field:

I have no idea what this box is and why it appears.

Does anyone know why it appears and how I can remove it?

Thank you

3 years later, not fixed 👍

UITextField with isSecureTextEntry in Catalyst display an empty box
 
 
Q