<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/safeAreaPadding(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE15safeAreaPaddingyQrAA4EdgeO3SetV_14CoreFoundation7CGFloatVSgtF"
  },
  "title" : "safeAreaPadding(_:_:)"
}
-->

# safeAreaPadding(_:_:)

Adds the provided insets into the safe area of this view.

```
@export(implementation) nonisolated func safeAreaPadding(_ edges: Edge.Set = .all, _ length: CGFloat? = nil) -> some View
```

## Discussion

Use this modifier when you would like to add a fixed amount
of space to the safe area a view sees.

```
ScrollView(.horizontal) {
    HStack(spacing: 10.0) {
        ForEach(items) { item in
            ItemView(item)
        }
    }
}
.safeAreaPadding(.horizontal, 20.0)
```

See the horizontal
[`safeAreaInset(edge:alignment:spacing:content:)`](/documentation/SwiftUI/View/safeAreaInset(edge:alignment:spacing:content:)-6gwby)
or vertical
[`safeAreaInset(edge:alignment:spacing:content:)`](/documentation/SwiftUI/View/safeAreaInset(edge:alignment:spacing:content:)-4s51l)
modifier for adding to the safe area based on the size of a view.

---

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)