SwiftUI.cc
SwiftUI API tag

alignment SwiftUI examples

Reference pages that use alignment, with practical code and implementation notes.

Showing 1-5 of 5 reference pages

Layer views deliberately with background, overlay, and zIndex while keeping the base layout stable.

4 min readOpen

VStack arranges children top to bottom and sizes itself to fit them. Control the gap with the spacing parameter and the horizontal placement with alignment.

4 min readOpen

HStack lays out children left to right with a shared vertical alignment. layoutPriority decides which child shrinks first when space runs out.

4 min readOpen

ZStack overlays children back to front with a shared alignment. Combine it with ignoresSafeArea for full-bleed backgrounds without pushing content under the notch.

4 min readOpen

containerRelativeFrame sizes a view as a fraction of its nearest container — full width, one-of-three columns, or custom math — without GeometryReader.

4 min readOpen