SwiftUI.cc
Latest SwiftUI references

Latest SwiftUI references, page 3

Continue browsing the newest published SwiftUI examples, API notes, and implementation checklists.

Showing 19-27 of 77 reference pages
PreviousPage 3 of 9Next

Pass child measurements up the view tree with PreferenceKey when a parent needs information children know first.

6 min readOpen

Represent unavailable, loading, private, and pass-through states with the right interaction and visual modifiers.

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

Grid aligns cells into true rows and columns, sizing each column to its widest cell. gridCellColumns spans columns and gridCellUnsizedAxes stops decoration from inflating the grid.

5 min readOpen

Spacer is a flexible blank view that absorbs leftover space along a stack's axis. Use minLength to keep a guaranteed gap and multiple Spacers for proportional layouts.

3 min readOpen

GeometryReader hands you the size and frame proposed by the parent so children can adapt. Read frames in .local, .global, or named coordinate spaces — and reach for it sparingly.

5 min readOpen

ViewThatFits tries each child in order and renders the first one that fits the proposed space — declarative responsive layout without measuring anything yourself.

4 min readOpen