We'll start by creating a new SwiftUI View. We'll create a new file in our Xcode project called RecipeDetailView by highlighting the group name in the File Tree, right-clicking and selecting New File. Select SwiftUI View from the User Interface options and then click Next. Call your new file RecipeDetailView.swift and click Create.
Our details view will allow us to view the ingredients and recipe details of a selected dish. There will be a bit more code in here than our previous files, but don't worry; we'll go through the code one change at a time. First, let's start by adding the following two properties to our new struct:
@State var recipe: RecipeModel!@State private var viewIndex = 0
The RecipeModel single ...