---
title: "safeAreaBar(edge:alignment:spacing:content:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/safeareabar(edge:alignment:spacing:content:)"
---

# safeAreaBar(edge:alignment:spacing:content:)

Shows the specified content as a custom bar beside the modified view.

## Declaration

```swift
nonisolated func safeAreaBar(edge: HorizontalEdge, alignment: VerticalAlignment = .center, spacing: CGFloat? = nil, @ContentBuilder content: () -> some View) -> some View

```

## Parameters

- `edge`: The horizontal edge of the view on which content is placed.
- `alignment`: The alignment guide used to position content vertically.
- `spacing`: Extra distance placed between the two views, or nil to use the default amount of spacing.
- `content`: A content builder function providing the view to display as a custom bar.

## Return Value

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

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.

## See Also

### Configuring scroll edge effects

- [scrollEdgeEffectStyle(_:for:)](swiftui/view/scrolledgeeffectstyle(_:for:).md)
- [scrollEdgeEffectHidden(_:for:)](swiftui/view/scrolledgeeffecthidden(_:for:).md)
- [ScrollEdgeEffectStyle](swiftui/scrolledgeeffectstyle.md)
