Skip to content

Root default #5

@andrej-jasso

Description

@andrej-jasso

When trying to use the @navigable without Tabs as Root of the navigation I need a root implementation e.g.

/// The main listing view for the app, showing all the articles we downloaded.
@NavigationRoot struct Root: View {

    @ViewModel private var viewModel = RootViewModel()
    var content: () -> ArticlesList

    var body: some View {
        switch viewModel.destination {
        case .root:
            NavigationStack {
                content()
            }
        case .none:
            EmptyView()
        }
    }

}

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