This is how SwiftUI can be inserted into NSToolbar using an accessory view controller:
NSToolbar
import SwiftUI import PlaygroundSupport var hostingView
It seems that applying PlainButtonStyle to the button helps. Default style is doing some weird magic that is breaking the layout in NSToolbar.
PlainButtonStyle