I have a TabView
with four tabs they look like this:
For example on Search
tab user can search products (presented in a List
) and then click on product (simple NavigationLink
) to open up more informations (ProductInfoView
) about that product (note Search
tab will remain selected).
So my question is:
if user clicks again on Search
tab, which is still selected, how can I pop up or dismiss ProductInfoView
and return to Search
tab?
Facebook has same functionality. Note also that: click on unselected tab will dismiss ProductInfoView
and show tab I just selected but clicking again on already selected tab in this case Search
while ProductInfoView
is open will not do anything.
I have found similar answer here: SwiftUI: How to pop to Root view
Probably I could implement that solution but I didn't find a way how to detect user click on already selected tabItem. I know that UITabBarController
has function which probably can do that:
override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
}
Maybe answer is simple but I'm still new in this field and struggling to do this. Thanks in advance.