toolbarMinimizationRestoration

Sets the restoration behavior for the specified bars during minimization.

View ModifieriOS 27.0+macOS 27.0+tvOS 27.0+watchOS 27.0+visionOS 27.0+toolbarMinimizationRestoration(_:for:) in SwiftUI

Declaration

React
compose().toolbarMinimizationRestoration(
  restoration: SwiftUI.ToolbarMinimizationRestoration,
  options: {
    for: SwiftUI.ToolbarPlacement[];
  }
)
Swift
nonisolated func toolbarMinimizationRestoration(
    _ restoration: ToolbarMinimizationRestoration,
    for bars: ToolbarPlacement...
) -> some View

Parameters

Discussion

Use this modifier alongside toolbarMinimizationBehavior(_:for:) to customize when a minimized bar restores. By default, the bar restores when the user reverses scroll direction. Use ToolbarMinimizationRestoration.atScrollEdge to restrict restoration to when the scroll view's content reaches the scroll edge -- appropriate for screens where the bar is mostly chrome that doesn't need to follow the user.

NavigationStack {
    ScrollView {
        // ...
    }
    .toolbarMinimizationBehavior(
        .onScrollDown, for: .navigationBar)
    .toolbarMinimizationRestoration(
        .atScrollEdge, for: .navigationBar)
}

Currently, only ToolbarPlacement.navigationBar supports customizing the restoration behavior, and only when used in combination with ToolbarMinimizationBehavior.onScrollDown.

See also

More in Navigation.