0PricingLogin
SwiftUI Academy · Lesson

Sizing Views with frame

Set width, height, and min/max constraints.

Views Size Themselves

By default a SwiftUI view is exactly as big as its content needs. When you want a specific size, you reach for the frame modifier to ask for one.

A Fixed Width and Height

The frame modifier lets you request an exact size. Here the text is placed inside a box that is 200 points wide and 80 points tall.

Text("Card")
    .frame(width: 200, height: 80)

All lessons in this course

  1. Adding Padding Around Views
  2. Sizing Views with frame
  3. Backgrounds & Corner Radius
  4. Spacer & Layout Priority
← Back to SwiftUI Academy