Contents

SpacerSizing

A type which defines how spacers should size themselves.

Declaration

struct SpacerSizing

Overview

Use this type in coordination with the ToolbarSpacer type to define if the spacer should be a flexible size, or a fixed size using system-defined sizing rules.

For example, the following adds a fixed-size toolbar spacer between the share and more buttons in the toolbar:

ContentView()
    .toolbar(id: "main-toolbar") {
        ToolbarItem(id: "tag") {
           TagButton()
        }
        ToolbarItem(id: "share") {
           ShareButton()
        }
        ToolbarSpacer(.fixed)
        ToolbarItem(id: "more") {
           MoreButton()
        }
    }

Topics

Type Properties

See Also

Styling a toolbar