I would go about your tab bar programmatically. I would create a new Cocoa Touch Class, calling it something like CustomTabBarController and subclassing it as a UITabBarController
. Go ahead to your App Delegate file and inside of your didFinishLaunchingWithOptions
function, add the following:
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
window?.rootViewController = CustomTabBarController()
Now, when your app launches, your rootViewController will be this tab bar view. Now inside of your viewDidLoad in your CustomTabBarController class, you'd simple implement your viewControllers in an array, which your tab bar will show and go to when touched like so:
let trainController = UIViewController()
let trainNavigationController = UINavigationController(rootViewController: trainController)
trainNavigationController.tabBarItem.image = UIImage(named: "your_tab_icon")?.withRenderingMode(.alwaysOriginal)
trainNavigationController.tabBarItem.selectedImage = UIImage(named: "your_tab_selected_icon")?.withRenderingMode(.alwaysOriginal)
let busController = UIViewController()
let busNavigationController = UINavigationController(rootViewController: trainController)
busNavigationController.tabBarItem.image = UIImage(named: "your_tab_icon")?.withRenderingMode(.alwaysOriginal)
busNavigationController.tabBarItem.selectedImage = UIImage(named: "your_tab_selected_icon")?.withRenderingMode(.alwaysOriginal)
viewControllers = [trainNavigationController, busNavigationController]
As for the JSON part, that's a totally different ball game. There are many tutorials online and on SO. Hope this helps and points you in the right direction. Good luck!