Instance Method

padding(_:_:)

Pads this view using the edge insets you specify.

Declaration

func padding(_ edges: Edge.Set = .all, _ length: CGFloat? = nil) -> some View

Parameters

edges

The set of edges along which to inset this view.

length

The amount to inset this view on each edge. If nil, the amount is the system default amount.

Return Value

A view that pads this view using edge the insets you specify.

Discussion

The following example only pads the horizontal edge insets:

List {
    Text("Item 1")
}
.padding([.horizontal])

See Also

Adjusting the Padding of a View

func padding(CGFloat) -> View

Pads this view along all edge insets by the amount you specify.

Beta
func padding(EdgeInsets) -> View

Pads this view using the edge insets you specify.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software