In this section, we'll take a look at how we can create custom and re-usable views to use in our List View. It's important that we understand the value of doing this early on, as it reduces the need for code duplication; while SwiftUI's declarative syntax is visually appealing, too much code in your struct can be daunting and very unnecessary.
Creating custom Views in Lists
Creating a custom view
First, let's start by creating another custom view, which, in turn, will house our layout and logic for each row. At the bottom of the ContentView.swift file, create the following struct in the format that would create a View struct for SwiftUI:
struct RecipeView: View {
var body: some View {
}
}
We&apos...