A value that defines the visibility priority of a toolbar item.
When a toolbar runs out of space, it moves items into an overflow
menu. Visibility priority controls the order in which that happens:
items with a lower priority move first, keeping higher-priority
items visible longer as the window shrinks.
Use values of this type with the
``ToolbarContent/visibilityPriority(_:)`` modifier. For example,
to keep a share button visible longer than an archive button:
struct RootView: View {
var body: some View {
ContentView()
.toolbar {
ToolbarItem {
SecondaryControl()
}
ToolbarItem {
PrimaryControl()
}
.visibilityPriority(.high)
}
}
}
Creates a priority higher than the specified value.
The priority is higher than `other` but doesn't cross above
the next higher system priority. For example,
`ToolbarItemVisibilityPriority(higherThan: .high)` returns a
value that is greater than `.high`.
Priorities created with the same base value are equal:
let x = ToolbarItemVisibilityPriority(higherThan: .high)
let y = ToolbarItemVisibilityPriority(higherThan: .high)
x == y // true
get · iOS 27.0+
low
TypeScript
static get low(): ToolbarItemVisibilityPriority
Swift declaration
static let low: ToolbarItemVisibilityPriority
A priority that moves the item to the overflow menu before
items with the default or high priority.
Use for secondary actions, such as archive or delete, that
don't need persistent visibility in the toolbar.
get · iOS 27.0+
high
TypeScript
static get high(): ToolbarItemVisibilityPriority
Swift declaration
static let high: ToolbarItemVisibilityPriority
A priority that keeps the item in the toolbar longer than
items with the default or low priority.
Use for frequently used actions that need to stay visible as
the toolbar shrinks.
get · iOS 27.0+
automatic
TypeScript
static get automatic(): ToolbarItemVisibilityPriority
Swift declaration
static let automatic: ToolbarItemVisibilityPriority
The default priority that lets the system determine the item's
visibility in the toolbar.
Creates a priority lower than the specified value.
The priority is lower than `other` but doesn't cross below
the next lower system priority. For example,
`ToolbarItemVisibilityPriority(lowerThan: .high)` returns a value
that is less than `.high` but greater than `.automatic`.
Priorities created with the same base value are equal:
let x = ToolbarItemVisibilityPriority(lowerThan: .high)
let y = ToolbarItemVisibilityPriority(lowerThan: .high)
x == y // true