init
TypeScriptstatic init(kind: ToolbarDefaultItemKind, placement?: ToolbarItemPlacement): DefaultToolbarItemSwift declarationnonisolated init(kind: ToolbarDefaultItemKind, placement: ToolbarItemPlacement = .automatic)Creates a system-defined toolbar item from a `ToolbarDefaultItemKind` at the given `placement`. Combinations of `kind` and `placement` may be valid on some platforms, but not on others. If the system has already placed a matching item `kind` in the toolbar, using a valid `DefaultToolbarItem` created by this initializer will implicitly replace the default-placed instance. You can use this to move default item kinds to other ``ToolbarItemPlacement``s, or to reposition default item kinds relative to other toolbar content. For example, the below code repositions the `.search` item in between other items in the bottom bar. The search item is the leading-most item by default: NavigationSplitView { AllCalendarsView() } detail: { SelectedCalendarView() .searchable($query) .toolbar { ToolbarItem(placement: .bottomBar) { CalendarPicker() } ToolbarItem(placement: .bottomBar) { Invites() } DefaultToolbarItem(kind: .search, placement: .bottomBar) ToolbarSpacer(placement: .bottomBar) ToolbarItem(placement: .bottomBar) { NewEventButton() } } } ### Specifying the Search Column `DefaultToolbarItem` also can be used to identify which column should be responsible for search when a ``NavigationSplitView`` is collapsed. Place the `DefaultToolbarItem` with the kind of `.search` in the column that should display the search field in compact. In the example below, the sidebar shows search in compact: NavigationSplitView { SidebarView() .toolbar { DefaultToolbarItem(kind: .search, placement: .bottomBar) } } content: { ContentView() } detail: { DetailView() } .searchable(text: $text) Note that this only applies when the search modifier is placed on the `NavigationSplitView`. - Returns: a `ToolbarItem` with content provided by the `kind`.