Spacing & Alignment in Stacks
Tune spacing and alignment between stacked views.
Fine-Tuning Your Stacks
You can stack views in three directions, but real layouts need control over the gaps and edges between them. Let's tune that. 🎛️
The spacing Argument
Every stack accepts a spacing value that sets the gap between its children. A bigger number spreads views farther apart.
VStack(spacing: 20) {
Text("Top")
Text("Bottom")
}All lessons in this course
- Stacking Views Vertically
- Rows with HStack
- Layering with ZStack
- Spacing & Alignment in Stacks