0

I have a general tabbed application in Swift. I would like to be able to trigger an action on the tabbarcontroller from a UIButton Touch within one of the view controllers.

The button is located in View Controller 2 and should trigger a segue back to view Controller 1 via the UITabbarController when touched.

enter image description here

Trey Pringle
  • 131
  • 5

1 Answers1

1

Found the answer:

@IBAction func buttonClicked(sender: AnyObject) {
    self.tabBarController?.selectedIndex = 0
}

**use appropriate index for the tab you want to accesss

Trey Pringle
  • 131
  • 5