ToolbarItemVisibilityPriority
A value that defines the visibility priority of a toolbar item.
Declaration
struct ToolbarItemVisibilityPriorityOverview
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 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)
}
}
}