Contents

toolbar(removing:)

Remove a toolbar item present by default

Declaration

nonisolated func toolbar(removing defaultItemKind: ToolbarDefaultItemKind?) -> some View

Parameters

  • defaultItemKind:

    The kind of default item to remove

Discussion

Use this modifier to remove toolbar items other Views add by default. For example, to remove the sidebar toggle toolbar item provided by NavigationSplitView:

NavigationSplitView {
    SidebarView()
        .toolbar(removing: .sidebarToggle)
} detail: {
    DetailView()
}

See Also

Removing default items