krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.14k stars 114 forks source link

Copy tabBarItem when embedded in TabBarController #35

Closed Patrick-Kladek closed 2 years ago

Patrick-Kladek commented 2 years ago

Description

When ViewControllerHost is added to a UITabBarController its tabBarItem is missing/no icon is shown in the TabBar.

Tasks

Infos for Reviewer

Here is my setup. I changed line 3 and added Inject.ViewControllerHost(...) which resulted in a missing tabBarItem (first image).

let tabBarController = UITabBarController()

let homeVC = Inject.ViewControllerHost(HomeViewController(app: self.app, dependencies: self.dependencies))
let homeNavigationVC = UINavigationController(rootViewController: homeVC)
homeNavigationVC.navigationBar.prefersLargeTitles = true

tabBarController.viewControllers = [homeNavigationVC, ...]

After my changes the tabBarItem correctly appears (2nd Image).

Result

Patrick-Kladek commented 2 years ago

Wrapping the UITabBarController inside ViewControllerHost does not work for me. I get a black screen after changing the source of HomeViewController. Maybe thats related to my setup with async/await. It works perfectly in this example with this changes.

krzysztofzablocki commented 2 years ago

thanks 🙇