I am new to Swift. How can I show the tab bar in all view controllers in swift 3 programmatically without using storyboard ?
The scenario is like as follows
1.I have 3 view controllers(e.g view1, view2, view3) attached with tab bar
2.When I clicked a button in side the view2 it navigates to another view controller(lets say view4) and in view4 the tab bar not appears
I have added the tab bar in a view controller(lets say homeView)
This is my code in side the viewDidLoad() of homeView
// Create Tab one
let homeviewController = view1()
let homeTabBarItem = UITabBarItem(title: nil, image: UIImage(named: "iconHome"), selectedImage: UIImage(named: "iconHome@3x"))
homeviewController.tabBarItem = homeTabBarItem
homeviewController.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0)
// Create Tab two
let categoryviewController = view2()
let categoryTabBarItem = UITabBarItem(title: nil, image: UIImage(named: "iconBrowse"), selectedImage: UIImage(named: "iconBrowse@3x"))
categoryviewController.tabBarItem = categoryTabBarItem
categoryviewController.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0)
// Create Tab three
let userprofviewController = view3()
let userTabBarItem = UITabBarItem(title: nil, image: UIImage(named: "iconProfile@3x"), selectedImage: UIImage(named: "iconProfile"))
userprofviewController.tabBarItem = userTabBarItem
userprofviewController.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0)
UITabBar.appearance().barTintColor = UIColor.black
UITabBar.appearance().itemPositioning = .fill
self.viewControllers = [homeviewController, categoryviewController, userprofviewController]
Thanks in advance