toolbarMinimizationRestoration(_:for:)
Sets the restoration behavior for the specified bars during minimization.
Declaration
nonisolated func toolbarMinimizationRestoration(_ restoration: ToolbarMinimizationRestoration, for bars: ToolbarPlacement...) -> some View
Parameters
- restoration:
The restoration behavior.
- bars:
The bars to apply the restoration behavior to.
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 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 navigationBar supports customizing the restoration behavior, and only when used in combination with onScrollDown.