You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I really like this architecture and have been using it for a while in one of my new apps (not yet released). Despite the deep learning curve it has really been worth the ride once I understood it all. (Well, almost)
Now, I've built my own custom TabBar using TCA and it works but my implementation together with TCACoordinator still makes me question whether I've done it right because it's looks a bit naive to me.
I have a MainView which combines the screens on each Tab and then the TabBar itself everything wrapped in a VStack like this:
I have removed some code in MainFeature in this example to not confuse too much with other features that i pulled back in this already
For me it feels weird that I have MainCoordinator.State pulled back in my MainFeature's state. Normally, based on the examples I looked on, you have a Feature pulled into a Coordinator defining all screens and then a CoordinatorView switching screens based on Coordinator's state and then a View.init for each case. But here, I feel like i'm doing a bit of a hack. Another drawback is that I'm trying to update MainFeature state based on state changes on each screen (Home, Forum or More screen) when any of their child state changes but that only works when you select a different tab than the one you're already on.
I hope anyone in this community can help out with a better solution. It would really be helpful to me. Please also comment on this if you have any questions of understanding my problem then I will try to clear it out.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi :)
First of all, I really like this architecture and have been using it for a while in one of my new apps (not yet released). Despite the deep learning curve it has really been worth the ride once I understood it all. (Well, almost)
Now, I've built my own custom TabBar using TCA and it works but my implementation together with TCACoordinator still makes me question whether I've done it right because it's looks a bit naive to me.
I have a MainView which combines the screens on each Tab and then the TabBar itself everything wrapped in a VStack like this:
My MainCoordinatorView looks likes this:
And then I have my MainFeature which keeps track of selected Tabs and corresponding screen:
I have removed some code in MainFeature in this example to not confuse too much with other features that i pulled back in this already
For me it feels weird that I have MainCoordinator.State pulled back in my MainFeature's state. Normally, based on the examples I looked on, you have a Feature pulled into a Coordinator defining all screens and then a CoordinatorView switching screens based on Coordinator's state and then a View.init for each case. But here, I feel like i'm doing a bit of a hack. Another drawback is that I'm trying to update MainFeature state based on state changes on each screen (Home, Forum or More screen) when any of their child state changes but that only works when you select a different tab than the one you're already on.
I hope anyone in this community can help out with a better solution. It would really be helpful to me. Please also comment on this if you have any questions of understanding my problem then I will try to clear it out.
Thanks.
/Dave.
Beta Was this translation helpful? Give feedback.
All reactions