Layout modifiers
Tell a view how to arrange itself within a view hierarchy by adjusting its size, position, alignment, padding, and so on.
Overview
Use layout modifiers to fine tune the placement of views in a view hierarchy. You can adjust or constrain the size, position, and alignment of a view. You can also add padding around a view, and indicate how the view interacts with system-defined safe areas.
To get started arranging views, see Layout fundamentals. To make adjustments to a basic layout, see Layout adjustments.
Topics
Size
frame(width:height:alignment:)frame(depth:alignment:)frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)frame(minDepth:idealDepth:maxDepth:alignment:)containerRelativeFrame(_:alignment:)containerRelativeFrame(_:alignment:_:)containerRelativeFrame(_:count:span:spacing:alignment:)fixedSize()fixedSize(horizontal:vertical:)layoutPriority(_:)
Position
Alignment
Padding and spacing
padding(_:)padding(_:_:)padding3D(_:)padding3D(_:_:)listRowInsets(_:)scenePadding(_:)scenePadding(_:edges:)listRowSpacing(_:)listSectionSpacing(_:)
Grid configuration
Safe area and margins
ignoresSafeArea(_:edges:)safeAreaInset(edge:alignment:spacing:content:)safeAreaPadding(_:)safeAreaPadding(_:_:)contentMargins(_:for:)contentMargins(_:_:for:)