---
title: "padding(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/padding(_:)-6pgqq"
---

# padding(_:)

Adds a different padding amount to each edge of this view.

## Declaration

```swift
nonisolated func padding(_ insets: EdgeInsets) -> some View

```

## Parameters

- `insets`: An doc://com.apple.SwiftUI/documentation/SwiftUI/EdgeInsets instance that contains padding amounts for each edge.

## Return Value

Return Value A view that’s padded by different amounts on each edge.

## Discussion

Discussion Use this modifier to add a different amount of padding on each edge of a view: VStack {     Text("Text padded by different amounts on each edge.")         .padding(EdgeInsets(top: 10, leading: 20, bottom: 40, trailing: 0))         .border(.gray)     Text("Unpadded text for comparison.")         .border(.yellow) } The order in which you apply modifiers matters. The example above applies the padding before applying the border to ensure that the border encompasses the padded region:

To pad a view on specific edges with equal padding for all padded edges, use padding(_:_:). To pad all edges of a view equally, use padding(_:).
