How to add a button to the viewcontroller? swift

The following code outputs an empty user interface. When I go to main in xcode and I were able to add a button manually. Then it shows the button. But I want to write code to add a button and I don't want to drag and drop components. How to insert (by typing) a button into the following code? I can see there is a button and a textfield, if those should be visible in runtime, let me know why they're not showing up?

import Cocoa

class ViewController: NSViewController {

    @IBOutlet weak var label: NSTextField!
    @IBOutlet weak var button: NSButton!

    override func viewDidLoad() {

        // Do any additional setup after loading the view.

    override var representedObject: Any? {
        didSet {
        // Update the view, if already loaded.

    @IBAction func buttonClicked(_ sender: Any) {
        label.stringValue = "Button clicked!"