We'll start with something simple as more of a proof of concept of how watchOS can harness SwiftUI. We'll also learn how we can reuse some of our classes and models from our parent application.
Using SwiftUI to create a list of recipes
Creating a List() view in watchOS
Let's start by heading on over to our ContentView.swift. Now, remember, that's ContentView.swift in our My Favourite Recipes Watch Extension group (not our parent app). Make the following highlighted changes:
struct ContentView: View {
var recipes = [RecipeModel]()
var body: some View {
VStack {
Text("Recipes")
.font(.headline)
List(recipes, id: \.id) { recipe in
...