I am trying to create a button for my app by code but I don't know how to program some action. Can somebody help me with it?
My code:
var newBut = NSButton(frame: NSRect(x: 150, y: 200, width: 30, height: 30))
newBut.title = "#"
self.view.addSubview(newBut)
Xcode version 9.2 (9C40b), Swift 4.