<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/safeAreaBar(edge:alignment:spacing:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE11safeAreaBar4edge9alignment7spacing7contentQrAA14HorizontalEdgeO_AA17VerticalAlignmentV14CoreFoundation7CGFloatVSgqd__yXEtAaBRd__lF::OverloadGroup"
  },
  "title" : "safeAreaBar(edge:alignment:spacing:content:)"
}
-->

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

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

```
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

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:)`](/documentation/SwiftUI/View/safeAreaInset(edge:alignment:spacing:content:)-6gwby)
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)