swiftui-tab-bar icon indicating copy to clipboard operation
swiftui-tab-bar copied to clipboard

Using UIViewControllerRepresentable means view lifecycle functions do not properly work because of how views are now disabled and hidden but still shown

Open bryan1anderson opened this issue 10 months ago • 1 comments

You recently implemented a change that made views no longer disappear so that the views were not completely deconstructed and reconstructed each time you switched tabs.

This has unforeseen consequences such as the fact that viewDidAppear does not get called when you switch to a tab. In my own project I implemented an EnvironmentKey that passed down "isViewVisible" that then manually called viewDidAppear on a UIViewControllerRepresentable.

However, viewDidAppear still gets called on all the view controllers on init of the tab bar, despite them not being shown.

bryan1anderson avatar Oct 09 '23 20:10 bryan1anderson