Stage 2 · Lesson 2 of 10
Xcode previews
The #Preview draws a view in 's canvas as you type. You can add several for one view, to see it with a long title, empty data or in . The canvas can switch devices, orientation and size (the user's text size setting).
Live mode lets you tap and scroll. Xcode Previews work best with views that take plain data. So pass sample values instead of making a view fetch its own.
When a preview fails, the error is often in code the view depends on, so keep sample data simple.
Common traponly ever looking at the preview on the latest large iPhone, never on a small one or in dark mode.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CourseFreeSwiftUI Tutorials (Apple)
Apple · Beginner
Apple's own path from views and stacks to lists and navigation
- CourseFree100 Days of SwiftUI
Paul Hudson (Hacking with Swift) · Beginner
Days 16 to 35 build six small apps on views, modifiers, lists and animation