saumya ranjan Gangwar
saumya ranjan Gangwar

Reputation: 73

How to switch on another tabItem in tabBar controller in swift 4

I am using Xcode 11.3.1, Swift 5. I made tabBarController with MainStoryBoard. Now I want to move on third item(another view controller) from first item(shown view controller), on click on button as shown in figure.

enter image description here

How to do I that?? Thanks in advance.

Upvotes: 0

Views: 63

Answers (1)

Jawad Ali
Jawad Ali

Reputation: 14397

Here is how you can do that

//MARK:- if you are in UITabBarController 
self.selectedIndex = 2

or

tabBarController?.selectedIndex = 2

Upvotes: 1

Related Questions