Instance Method


Pads the view along all edges by the specified amount.


func padding(_ length: CGFloat) -> some View



The amount to pad this view on each edge.

Return Value

A view that pads this view by the amount you specify.


Use padding(_:) to add a specific amount of padding around all edges of the view.

VStack {
    Text("Text padded by 10 points on each edge.")
    Text("Unpadded text")
A view showing 10 points of padding to all edges.

See Also

Adjusting the Padding of a View

func padding(EdgeInsets) -> View

Pads this view using a system default amount inside the edges you specify.

func padding(Edge.Set, CGFloat?) -> View

A view that pads this view inside the specified edge insets with a system-calculated amount of padding.

struct EdgeInsets

The inset distances for the sides of a rectangle.