So I want to do something like this in Xcode (using Swift):
There should be a TabBar VC that contains 2 VCs under a single tab. But when one of the tabs is opened, it should show the second VC icon and allow me to switch back and forth among the 2 VCs using the same button.
Like, when you tap on "List", it shows the List ViewController, and the "List" tab then changes to "Map", and vice versa.
EDIT: Incorporated the explanation made by Chan.
You can do this using below Steps:
Take a
ContainerView
for your Tabbar's first tab (That may be the ThirdVC).SubClass your
UITabBarController
.Manage one
Global
variable for current showing VC in app delegate or your gloal class.Perform check and update task here (In subclass of your tabbar controller)
//Here you can write your logic to update the view controller for first tab. Get reference of FirstVC here or create a delegate from where you can update your first Tab.
override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) { var selectedIndex = self.selectedIndex if selectedIndex == 0 { if currentVC == First { }else { } } }