To init a button in Objective-C I do the following (old fashion style) :
------------------------
@interface …
{
IBOutlet NSButton *__strong aButton;
…
}
@property(strong) NSButton *__strong aButton;
------------------------
@implementation …
@synthesize aButton;
------------------------
How can this be done in iOS and Swift?
You can also do it by code. Here is an example
var loginButton: UIButton
loginButton = UIButton(frame: CGRect(x: 80, y: 30, width: 100, height: 30))
loginButton.setTitle("Tweet", for: UIControl.State.normal)
loginButton.addTarget(self, action: #selector(buttonTweetAction), for: UIControl.Event.touchUpInside)
view.addSubview(loginButton) // Add the button to the view