Closed reetm09 closed 4 years ago
You should be able to put the care view controller into a UITabBarController
just as you would with any other iOS view controller.
For our sample app, you would tweak the code in SceneDelegate.swift to look like this.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let manager = appDelegate.synchronizedStoreManager
let careViewController = UINavigationController(rootViewController: CareViewController(storeManager: manager))
careViewController.tabBarItem = UITabBarItem(title: "Care", image: UIImage(systemName: "heart.circle")!, tag: 0)
let otherViewController = UIViewController()
otherViewController.tabBarItem = UITabBarItem(title: "Other", image: UIImage(systemName: "bandage")!, tag: 1)
let tabController = UITabBarController()
tabController.setViewControllers([careViewController, otherViewController], animated: false)
if let windowScene = scene as? UIWindowScene {
window = UIWindow(windowScene: windowScene)
window?.rootViewController = tabController
window?.tintColor = UIColor { $0.userInterfaceStyle == .light ? #colorLiteral(red: 0.9960784314, green: 0.3725490196, blue: 0.368627451, alpha: 1) : #colorLiteral(red: 0.8627432641, green: 0.2630574384, blue: 0.2592858295, alpha: 1) }
window?.makeKeyAndVisible()
}
}
Closing due to lack of activity. Feel free to reopen if you still have questions!
I've been trying to find documentation on how to make the care view controller show up on a tab but can't find any, the only way i can do it is to present which is not efficient and the other way I do it, the navigation bar on the top doesn't show up. Where and how can I get careView to show up when I click on a tab bar button?
Thanks!