Disable password autofill in MacOS app

I have an NSSecureTextField field in my MacOS app. I want to disable the password autofill option from coming up (the "Passwords..." button). How can I do this?
Post not yet marked as solved Up vote post of coderkid Down vote post of coderkid
2.6k views

Replies

I have the same problem with my password manager app.

Setting the NSTextContentType to NSTextContentTypeOneTimeCode may help, although in my case this makes it only slightly less annoying. What is needed is a way to disable the behaviour completely. This is now available with UIKit on iOS (UITextContentTypeNewPassword).

I have a couple of NSSecureTextFields and they don't all behave the same way. Some heuristics are in play to enable the behaviour. Better documentation from Apple would be appreciated!

I provide a solution here. It is not pretty. But it works.