[Suggestion] Expose TabBarModel and HeaderModel as public.
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.
Good callout. I hadn't run into a case for a custom tab bar implementation yet. Why did you end up needing a custom tab bar in the first place?
My tab bar is left-aligned self-sizing capsules that are scrollable on demand, with an optional trailing view.
Gotcha. I think built-in tab bar does all of that except the trailing view, which could be added. But I'm also good with making those components public.
I believe the left-aligned tabs and uneven tab width is not achievable with the MaterialTabBar either right now. I may be mistaken, but I'm pretty sure of it.