I create a new OS X document based application. I add a push button on the screen.
Normally I have to ctrl/drag the button to the code to be able to change the button properties in the code, and to execute an action when the button is clicked. Instead of ctrl/drag, how can I do that programmatically?
If you really wanted to you could probably dig into the Storyboard file and see what changes when you make that connection, then in future edit in your own connection code. But I don’t think there is a way to make the connection programmatically that is practically better or simpler.
(Though I wish there was - I have one project in a state that instantly crashes Xcode 8 as soon as I try and make a new connection. For now I have to add the IBOutlet/IBAction line in the source file and then drag the connection from the counterpart file into the storyboard file, it’s the only way I can do it. Too complex to discard the Storyboard file and do over.)