Without resorting to NSViewRepresentable
, is there a view or view modifier in SwiftUI that can create an NSComboButton
on macOS?
NSComboButton
was introduced in macOS 13 and is (relatively) new to AppKit:
Apple Developer - NSComboButton
I only require support on macOS for this control.
Note that this is not to be confused with NSComboBox
, which is a completely different control.
You can use one of the Menu
initializers that takes a primaryAction block. The primaryAction
is invoked by the main labeled part of the button, and the menu content is attached to the separate disclosure indicator.