Contents

toolbarMinimizationSafeAreaAdjustment(_:for:)

Sets the safe area adjustment for the specified bars during minimization.

Declaration

nonisolated func toolbarMinimizationSafeAreaAdjustment(_ adjustment: ToolbarMinimizationSafeAreaAdjustment, for bars: ToolbarPlacement...) -> some View

Parameters

  • adjustment:

    The safe area adjustment.

  • bars:

    The bars to apply the adjustment to.

Discussion

By default, the safe area adjusts as bars minimize, allowing content to reflow into the space vacated by the bar. Use this modifier to disable that adjustment when content should remain in place – for example, when displaying full-bleed media beneath a minimizing bar.

Currently, only navigationBar supports customizing the safe area adjustment.

Use this modifier alongside toolbarMinimizeBehavior(_:for:):

NavigationStack {
    ScrollView {
        // ...
    }
    .toolbarMinimizeBehavior(
        .onScrollDown, for: .navigationBar)
    .toolbarMinimizationSafeAreaAdjustment(
        .disabled, for: .navigationBar)
}

See Also

Minimizing a toolbar