0Pricing
Swift Academy · Lesson

Spacer, Padding and Frame Modifiers

Using Spacer for flexible gaps and frame to set explicit sizes.

Welcome

`Spacer`, `.padding()`, and `.frame()` are the primary tools for controlling spacing and sizing in SwiftUI. Let's master each.

Spacer — Flexible Space

```swift HStack { Text("Left") Spacer() // fills all available space Text("Right") } ``` `Spacer` expands to fill remaining space along the stack axis.

All lessons in this course

  1. VStack, HStack and ZStack Fundamentals
  2. LazyVGrid and LazyHGrid
  3. Spacer, Padding and Frame Modifiers
  4. GeometryReader for Adaptive Layouts
← Back to Swift Academy