You need to set the NSButton
's action
. For example:
let button = NSButton()
button.target = self
button.action = #selector(someAction)
From NSButton Class Reference:
NSButton is a subclass of the NSControl class. An NSButton object
sends an action message to a target object, such as a view controller,
when the button is clicked.