NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated

How to get rid of this warning?

NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated.

I do not set minSize or maxSize, it is Interface Builder that seems to do this. Even if I create completely new interface from scratch, this warning still appears.

What is the point of introducing this warning if Apple tools unable to produce correct behaviour?
Answered by lanatus in 649992022
Changing ToolbarItem size to Automatic in an xib does not remove the warning.
Remove the toolbar items min and max size in Interface Builder.
Accepted Answer
Changing ToolbarItem size to Automatic in an xib does not remove the warning.
I get the same warnings, and I'm building my toolbar items programatically. I don't set the maxSize or minSize values in my code at all, and it still complains at me. I think it's probably an issue with default arguments when building an NSToolbarItem.
Using XCode 12.3, changing the Size parameter on Toolbar item from Explicit to Automatic fixes the error.
In Big Sur when created tool bar item programmatically (from a view in Interface Builder), I get that warning when I use setMinSize and setMaxSize. The problem is that if I don't set them, Big Sur does not display them correctly in the customize tool bar sheet for the window (setting them fixes that but causing warnings).

One "solution" above said to set "size" of Tool bar item to "Automatic", but I don't see a programmatic option to set "size" property of a NSToolBarItem?

And how do I set a minimum size for a toolbar item with a slider control in it? I want a minimum size, but I want it to be able to get wider than the minimum size on its own. If I don't set a minimum size, the toolbar shrinks the slider to as small as 32px wide, which I don't want.

Try to set a constrain on the width.

It appears in my case - after switching the size mode to 'Automatic' for all items - a stray NSToolbarSeparatorItem (deprecated) was causing the warning.
After removing the NSToolbarSeparatorItem the warning was gone..

Cheers,
Jay

NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated
 
 
Q