safeAreaBar

Shows the specified content as a custom bar above or below the modified view.

View ModifieriOS 26.0+macOS 26.0+tvOS 26.0+watchOS 26.0+visionOS 26.0+

Overloads

2 ways to call compose().safeAreaBar(). Each is one SwiftUI overload, picked by the arguments you pass.

React
compose().safeAreaBar({
  edge: SwiftUI.VerticalEdge,
  alignment?: SwiftUI.HorizontalAlignment,
  spacing?: number | null,
  content: ReactNode,
})
Swift
nonisolated func safeAreaBar(
    edge: VerticalEdge,
    alignment: HorizontalAlignment = .center,
    spacing: CGFloat? = nil,
    @ContentBuilder content: () -> some View
) -> some View

Parameters

  • The vertical edge of the view on which content is placed.

  • The alignment guide used to position content horizontally.

  • options.spacingnumber | null

    Extra distance placed between the two views, or nil to use the default amount of spacing.

  • options.content*ReactNode

    A content builder function providing the view to display as a custom bar.

Return value

A new view that displays content above or below the modified view, making space for the content view by vertically insetting the modified view, adjusting the safe area and scroll edge effects to match.

Discussion

Similar to the View.safeAreaInset(edge:alignment:spacing:content:)-4s51l modifier, the content view is anchored to the specified vertical edge of the parent view and its height insets the safe area.

Additionally, it extends the edge effect of any scroll views affected by the inset safe area.

See also

More in Layout.