I would like to enable and disable programmatically a toolbar item (a button) of a NSToolBar in macOS. I tried to create an outlet to ViewController control-dragging but Xcode don't accept the drop. How can I do this?
I read this question about a similar question with Objective-C answers but I'm a beginner and can't understand well how to do this in Swift.
Implement the delegate method
You can distinguish the items for example by the
itemIdentifier
and returntrue
to enable andfalse
to disable the itemThe documentation provides an example.