Search code examples
iosswift3uitabbarcontrolleruitabbaritem

iOS Swift Tabbar Controller Add Item (new tab) programmatically


My App have Tab bar Controller, Which have 4 Tab bar items. I need to add one more tab bar item as 5th, is it possible to add new item as programmatically.


Solution

  • In viewDidload of your first tab(viewController), you can do something like,

       self.tabBarController?.viewControllers?.append(viewController)
    

    here viewController is your 5th tab!