I share the solution I use today that can be used with iOS 27 with the priorities while still working as before on older iOS.
Part 1/2
//
// ToolbarContentExtension.swift
//
// Created by L'Appli en Rose, Paris on 23/09/2026.
// No Rights Reserved, Free to use
// SPDX-License-Identifier: CC0-1.0
import SwiftUI
extension ToolbarContent {
/// Defines the visibility priority for a toolbar item after iOS 27 / iPadOS27 and visionOS 27.
/// **Does nothing on previous versions.**
///
/// When toolbar space is limited, items with a lower priority
/// move into the overflow menu before items with a higher priority.
/// The default is ``ToolbarItemVisibilityPriorityIfAvailable/automatic``.
///
/// For example, an important control can appear at the trailing edge
/// of the toolbar, but still be shown as the window is made smaller:
///
/// struct RootView: View {
/// var body: some View {
/// ContentView()
/// .toolbar {
/// ToolbarItem {
/// SecondaryControl()
/// }
/// ToolbarItem {
/// PrimaryControl()
/// }
/// .visibilityPriorityIfAvailable(.high)
/// }
/// }
/// }
///
/// - Parameter priority: The visibility priority for this toolbar
/// item.
@MainActor @preconcurrency func visibilityPriorityIfAvailable(_ priority: ToolbarItemVisibilityPriorityIfAvailable) -> some ToolbarContent {
if #available(iOS 27.0, macOS 26.1, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) {
let newLevel: ToolbarItemVisibilityPriority
switch priority.level {
case .low: newLevel = .low
case .high: newLevel = .high
case .lowerThanLow: newLevel = ToolbarItemVisibilityPriority(lowerThan: .low)
case .lowerThanAutomatic: newLevel = ToolbarItemVisibilityPriority(lowerThan: .automatic)
case .lowerThanHigh: newLevel = ToolbarItemVisibilityPriority(lowerThan: .high)
case .higherThanLow: newLevel = ToolbarItemVisibilityPriority(higherThan: .low)
case .higherThanAutomatic: newLevel = ToolbarItemVisibilityPriority(higherThan: .automatic)
case .higherThanHigh: newLevel = ToolbarItemVisibilityPriority(higherThan: .high)
default: newLevel = .automatic
}
return self.visibilityPriority(newLevel)
} else { // Prior to OS 27, no modifcation to the ToolbarContent
return self
}
}
}