We have a Mac app the allows customers to create a user account in our system.
However, we have found that on the 'create account' screen, the system's password autofill is popping up for the "New Password" field. We don't want this, because they need to enter a new password, not pull one from the Passwords app.
I built a test project with a basic UI and explicitly set the content type to None in the XIB. However, I can see when I put focus on the "New Password" NSSecureTextField, the system shows the passwords autofill popup.
How can I explicitly suppress this on a per text field basis?
(We are developing on macOS 26.3 right now with Xcode 26.3)
Hi @iang,
You wrote:
[...] However, we have found that on the 'create account' screen, the system's password autofill is popping up for the "New Password" field. We don't want this, because they need to enter a new password, not pull one from the Passwords app. [...] How can I explicitly suppress this on a per text field basis? [...]
When you set the contentType to nil or "None" in the XIB, your app tells the system to infer the appropriate type at runtime (instead of suppressing the AutoFill behavior). Since the field is an NSSecureTextField, the system heuristically concludes it's a password field and shows the Password AutoFill popup regardless.
To resolve this, set the contentType to .newPassword.
This tells the system the field is for creating a password rather than filling an existing one. However, it may still show a "Suggest Strong Password" suggestion, but it will stop offering saved credentials:
override func viewDidLoad() {
super.viewDidLoad()
newPasswordField.contentType = .newPassword
confirmPasswordField.contentType = .newPassword
}
If you want to suppress the strong-password suggestion too, NSTextField exposes isAutomaticTextCompletionEnabled:
verride func viewDidLoad() {
super.viewDidLoad()
newPasswordField.contentType = .newPassword
newPasswordField.isAutomaticTextCompletionEnabled = false
}
This should suppress both the Password AutoFill popup and the strong-password suggestion.
Cheers,
Paris X Pinkney | WWDR | DTS Engineer