Skip to content

[Suggestion] Expose TabBarModel and HeaderModel as public. #25

@demon9733

Description

@demon9733

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions