Reasoning:
When creating a custom tab bar, I'm forced to do something like:
struct ScrollableTabBar<Tab: DisplayableTab>: View {
@Binding var selectedTab: Tab
var tabs: [Tab]
init(selectedTab: Binding<Tab>, tabs: [Tab]) {
...
providing the tabs array that's synchronized with the actual tabs, and basing the tab labels on my DisplayableTab protocol.
And tabs are registered with:
.materialTabItem(tab: tab) { _, _, _ in
// The tab label is not used due to custom tab bar setup
EmptyView()
}
Different screens may require different tab labels, which can blow up the DisplayableTab eventually.
Solution:
Exposing TabBarModel and HeaderModel would allow to benefit from EnvironmentObject-s to render the tab labels provided by the materialTabItem.
Reasoning:
When creating a custom tab bar, I'm forced to do something like:
providing the tabs array that's synchronized with the actual tabs, and basing the tab labels on my
DisplayableTabprotocol.And tabs are registered with:
Different screens may require different tab labels, which can blow up the
DisplayableTabeventually.Solution:
Exposing
TabBarModelandHeaderModelwould allow to benefit fromEnvironmentObject-s to render the tab labels provided by thematerialTabItem.