Use this file to discover all available pages before exploring further.
These modifiers control where a component sits and how much space it claims. frame sets fixed or flexible dimensions; containerRelativeFrame sizes a component relative to its nearest scrollable container; padding adds space around it.offset shifts the visual position without affecting layout, zIndex controls stacking order inside a ZStack, and layoutPriority decides which sibling wins when space is tight.
How to align the content within the frame. See Alignment.
The fixed frame overload sets exact dimensions. The flexible frame overload sets constraints — the component sizes itself within those bounds based on its content and the parent’s size proposal. Use Infinity for maxWidth or maxHeight to make the component expand to fill all available space.Fixed size
The fraction of the container’s size to use (0.0 to 1.0).
The nearest container is the closest ancestor ScrollView, List, or NavigationStack. The modifier sizes the component relative to that container’s visible area, not the full scrollable content. The grid subdivision form calculates the cell width as: (containerWidth - (count - 1) * spacing) / count * span + (span - 1) * spacing.Fill the container horizontally
The offset is purely visual. The component’s original layout space is preserved — surrounding components aren’t affected by the offset. For layout-affecting position changes, use padding instead.Shifting a component
The stacking priority. Higher values render on top of lower values. The default is 0.
zIndex only affects rendering order within the same parent container. Without it, components in a ZStack render in order: first child at the bottom, last child on top. Negative values are valid and place the component behind siblings with the default zIndex(0).Bring a component to front
The layout priority. Higher values receive preference for available space. Default is 0.
Layout priority only matters when sibling components compete for limited space within a parent container (e.g., HStack, VStack). All components default to a priority of 0. A component with priority 1 is offered its ideal size before components with priority 0. Negative values are valid and cause the component to shrink before siblings.Prioritizing one text over anotherWhen two texts compete for space in an HStack, the one with higher layout priority gets its full width before the other.
HStack([ Text("This text should get more space") .layoutPriority(1), Text("Secondary text")])