One Logo Pool Ball
SwiftUI · IOS API REFERENCE

ToolbarSpacer

struct · iOS 26.0+ · SDK 27.1

nonisolated struct ToolbarSpacer

A standard space item in toolbars. A space item creates visual breaks in the toolbar between items. Spacers can have a standard fixed size or be flexible and push items apart. Spacers can also be used in customizable toolbars: ContentView() .toolbar(id: "main-toolbar") { ToolbarItem(id: "tag") { TagButton() } ToolbarItem(id: "share") { ShareButton() } ToolbarSpacer(.fixed) ToolbarItem(id: "more") { MoreButton() } } Space items are customizable and can be added, removed, and rearranged by users. If a customizable toolbar supports a spacer of a given type, users can also add in multiple copies of that spacer from the customization panel.

Members (1)

init · iOS 26.0+

init

TypeScript
static init(sizing?: SpacerSizing, placement?: ToolbarItemPlacement): ToolbarSpacer
Swift declaration
nonisolated init(_ sizing: SpacerSizing = .flexible, placement: ToolbarItemPlacement = .automatic)

Creates a toolbar spacer item with the specified sizing behavior and placement.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →