<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/scenePadding(_:edges:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE12scenePadding_5edgesQrAA05SceneE0V_AA4EdgeO3SetVtF"
  },
  "title" : "scenePadding(_:edges:)"
}
-->

# scenePadding(_:edges:)

Adds a specified kind of padding to the specified edges of this view
using an amount that’s appropriate for the current scene.

```
nonisolated func scenePadding(_ padding: ScenePadding, edges: Edge.Set = .all) -> some View
```

## Parameters

`padding`

The kind of padding to add.

`edges`

The set of edges along which to pad this view.

## Return Value

A view that’s padded on specified edges by a
scene-appropriate amount.

## Discussion

Use this modifier to add a scene-appropriate amount of padding to a
view. Specify either a single edge value from [`Edge.Set`](/documentation/SwiftUI/Edge/Set), or an
<doc://com.apple.documentation/documentation/Swift/OptionSet> that
describes the edges to pad.

In macOS, use scene padding to produce the recommended spacing around
the root view of a window. In watchOS, use scene padding to align
elements of your user interface with top level elements, like the title
of a navigation view. For example, compare the effects of different
kinds of padding on text views presented inside a [`NavigationView`](/documentation/SwiftUI/NavigationView)
in watchOS:

```
VStack(alignment: .leading, spacing: 10) {
    Text("Minimum Scene padding")
        .scenePadding(.minimum, edges: .horizontal)
        .border(.red) // Border added for reference.
    Text("Navigation Bar Scene padding")
        .scenePadding(.navigationBar, edges: .horizontal)
        .border(.yellow)
    Text("Regular padding")
        .padding(.horizontal)
        .border(.green)
    Text("Text with no padding")
        .border(.blue)
    Button("Button") { }
}
.navigationTitle("Hello World")
```

The text with minimum scene padding uses the system minimum padding
and the text with navigation bar scene padding automatically aligns
with the navigation bar content. In contrast, the text that uses the
default padding and the text without padding do not align with scene
elements.

Scene padding in watchOS also ensures that your content avoids the
curved edges of a device like Apple Watch Series 7.
In other platforms, scene padding produces the same default padding that
you get from the [`padding(_:_:)`](/documentation/SwiftUI/View/padding(_:_:)) modifier.

> Important: Scene padding doesn’t pad the top and bottom edges of a
> view in watchOS, even if you specify those edges as part of the input.
> For example, if you specify ``doc://com.apple.SwiftUI/documentation/SwiftUI/Edge/Set/vertical`` instead of
> ``doc://com.apple.SwiftUI/documentation/SwiftUI/Edge/Set/horizontal`` in the example above, the modifier would have
> no effect in watchOS. It does, however, apply to all the edges that you
> specify in other platforms.

---

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)