2

I'm learning cocoa swift and i'm stuggling with accessing outlet from my custom NSSplitViewController with NSTabViewController. My goal is to change the tab when I clicked the button from the split view.

enter image description here

class CustomTabView: NSTabViewController {

    @IBOutlet weak var MyTabView: NSTabView!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do view setup here.
        MyTabView.selectTabViewItem(at: 1)
    }
}


class CustomSplitView: NSSplitViewController {

    @IBAction func onClickButton(_ sender: NSButton) {
        let tabView = CustomTabView()
        tabView.MyTabView.selectTabViewItem(at: 0)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do view setup here.
    }
}

The result is Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value.

You guy have anyidea?

0 Answers0