Understanding Automatic Preview

Automatic Preview will no doubt play a big role as you venture into the world of SwiftUI as you'll be able to create your content with the ease and beauty of SwiftUI's declarative syntax and the ability to see your changes hot-reload instantly in front of you. But the ability to inject mock data at the same time will not only save you time but let you effectively make structural designs with ease.

Let's start by taking a look at what we mean by this. In your new project, update your body with the following code:

 var body: some View {     Group {         VStack {             List(recipeNames, id: \.self) { name in                 Text("\(name)")             }             List(recipeModel.recipes, id: \.self) { name in                 Text("\(name)")             }         }     } }

Here, we have a Group since ...

Get Learn SwiftUI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.