Return Value 戻り値
A view that’s padded by different amounts on each edge.
Availability 有効性
Technology
func padding(_ insets: EdgeInsets
) -> some View
A view that’s padded by different amounts on each edge.
insets
An Edge
instance that contains padding amounts for each edge.
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(_:)
.