Any examples of using a swiftui tabview with the d...
# mvikotlin
i
Any examples of using a swiftui tabview with the decompose router?
a
I'm not aware of any such examples yet, but would like to see!
i
One thought I had was just using a single component within each tabbed view. In my case they are related. I suppose in that case I wouldn’t necessarily need the router. As I’m thinking about it I don’t know if using the router makes sense as the Tabview has to be attached to Views. Whereas when I’m using the router the view is determined by the state of the router configuration.
a
Does it mean that TabView controls its views on its own? I would expect it to be just simple togglable buttons.
i
If you look at how it works the tabview is essentially the parent and each view a child. I think if you wanted to have something that works with the router you might build a custom toolbar that calls the router when each item is clicked. In that case the toolbar would have to be included in each view that displays it. I’m fairly green with swiftui so someone with more experience might have a better solution.
a
Not necessarily. The toolbar (tab view) could be at the parent level. Clicking on a button would trigger the router and the child view would be replaced. I would try implementing custom TabView, just a row of buttons.
👀 1