Before I saw any views detach, I had to do two things:
Call
-[NSStackView setClippingResistancePriority:forOrientation:]
. If the size of the stack view is tied to the size of the window, the priority needs to be less thanNSLayoutPriorityWindowSizeStayPut
(500) or the stack view doesn't allow the window to get smaller than its content.Each time I added a view to the stack view that I wanted to detach, call
-[NSStackView setVisibilityPriority:forView:]
for that view.