0

Sorry, if it is an essential question.

The scheme is the following: enter image description here

I want the following:

  1. User taps last Tab
  2. User goes to some ViewController (different from ViewController, actually connected with last Tab)

How to do this (without using segue)?

Thanks a lot in advance!

2 Answers2

0

You can go with instantiateViewController with push when load your tab and push one viewController to another like below:

 let next = self.storyboard?.instantiateViewController(withIdentifier: "nextVC")as! nextVC
 self.navigationController?.pushViewController(next, animated: true)
Virani Vivek
  • 888
  • 1
  • 8
  • 22
0

You can assign ViewController in you UITabBarController

         let storyboard = UIStoryboard(name: "Main", bundle: nil)
        
        // create view controllers from storyboard
        // Make sure you set Storyboard ID for both the viewcontrollers in 
        // Interface Builder -> Identitiy Inspector -> Storyboard ID
        let clockViewController = storyboard.instantiateViewControllerWithIdentifier("ClockViewController")
        let stopWatchViewController = storyboard.instantiateViewControllerWithIdentifier("StopWatchViewController")
        
        // Set up the Tab Bar Controller to have two tabs
        let tabBarController = UITabBarController()
        tabBarController.viewControllers = [clockViewController, stopWatchViewController]
        
        // Make the Tab Bar Controller the root view controller
        window?.rootViewController = tabBarController
Ron Gahlot
  • 1,396
  • 8
  • 18