Is it possible to set NSToolbarItem size to automatic via code?

Big Sur toolbar seems to prefer size of toolbar items to be set to automatic. Unfortunately, there doesn't seem to be a way to do this programmatically (using NSToolbarDelegate & NSToolbarItem), it seems to only be available when creating the toolbar with Xcode XIB editor.

I have several places in my app that use dynamically created NSToolbars and would like to find a way to address some of the display problems (as well as warnings) under future macOS releases because of this sizing issue.

Is there a way to set the size of NSToolbarItems to be automatic programmatically?

Same issue here!

10 months.. no answer - problems like these demonstrate why it's so much fun to create apps on macOS. Really, really sad state of affairs.

Could this very old thread be of some help ? https://developer.apple.com/forums/thread/73357

Cheers - saw that before when searching, but doesn't really apply.

I've ended up sprinkling my code with @available conditionals and setting min/maxSize for NSToolbarItems programmatically for legacy macOS versions (many of my users are still running for sure).

Is it possible to set NSToolbarItem size to automatic via code?
 
 
Q