Now that we've successfully created our own custom view, let's take this a step further and extract this into its own file, so that we can work on this independently should we ever need to. To do that, follow these steps:
- Create a new file in our Xcode project called RecipeView, by highlighting the group name in the file tree, then right-click and select New File:
-
Select SwiftUI View from the User Interface options and click Next. Call your new file RecipeView.swift and click Create.
Once you've done that, you should see some boilerplate code again, however, you'll be presented with the following ...