safeAreaBar(edge:alignment:spacing:content:)
Shows the specified content as a custom bar beside the modified view.
Declaration
nonisolated func safeAreaBar(edge: HorizontalEdge, alignment: VerticalAlignment = .center, spacing: CGFloat? = nil, @ViewBuilder content: () -> some View) -> some View
Parameters
- edge:
The horizontal edge of the view on which
contentis placed. - alignment:
The alignment guide used to position
contentvertically. - spacing:
Extra distance placed between the two views, or nil to use the default amount of spacing.
- content:
A view builder function providing the view to display as a custom bar.
Return Value
A new view that displays content beside the modified view, making space for the content view by horizontally insetting the modified view, adjusting the safe area and scroll edge effects to match.
Discussion
Similar to the safeAreaInset(edge:alignment:spacing:content:) modifier, the content view is anchored to the specified horizontal edge of the parent view and its width insets the safe area.
Additionally, it extends the edge effect of any scroll views affected by the inset safe area.