How to change NSViewController Tab Programmatically on macOS applications

Viewed 24

I have a macOS application that have a TabViewController. The controller has 2 tabs and ViewControllers.

I Also have another viewController that is used as a sidebar with buttons.

I am trying to figure out how can I change the tab view or tab index using the buttons from my sidebar

Not sure where to start with coding.

I created an @IBAction with the following code in my view controller class


@IBAction func buttonTapped(_ sender: UIButton) {
   self.tabBarController.selectedIndex = 1
}

No success

enter image description here

0 Answers
Related