One Logo Pool Ball
SwiftUI · IOS API REFERENCE

DefaultToolbarItem

struct · iOS 26.0+ · SDK 27.1

nonisolated struct DefaultToolbarItem

A toolbar item that represents a system component. Place this item in your toolbar to control where the system-provided item, like search, will be positioned.

Members (1)

init · iOS 26.0+

init

TypeScript
static init(kind: ToolbarDefaultItemKind, placement?: ToolbarItemPlacement): DefaultToolbarItem
Swift declaration
nonisolated 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`.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

DefaultToolbarItem.body

This protocol needs associated types that cannot yet cross the bridge.

All SwiftUI types →