<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/safeAreaInset(edge:alignment:spacing:content:)-6gwby",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE13safeAreaInset4edge9alignment7spacing7contentQrAA14HorizontalEdgeO_AA17VerticalAlignmentV14CoreFoundation7CGFloatVSgqd__yXEtAaBRd__lF"
  },
  "title" : "safeAreaInset(edge:alignment:spacing:content:)"
}
-->

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

Shows the specified content beside the modified view.

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

## Parameters

`edge`

The horizontal edge of the view to inset by the width of
`content`, to make space for `content`.

`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 in the inset space of the modified view.

## Return Value

A new view that displays `content` beside the modified view,
making space for the `content` view by horizontally insetting
the modified view.

## Discussion

The `content` view is anchored to the specified
horizontal edge in the parent view, aligning its vertical axis
to the specified alignment guide. The modified view is inset by
the width of `content`, from `edge`, with its safe area
increased by the same amount.

```
struct ScrollableViewWithSideBar: View {
    var body: some View {
        ScrollView {
            ScrolledContent()
        }
        .safeAreaInset(edge: .leading, spacing: 0) {
            SideBarContent()
        }
    }
}
```

---

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)