Creating an iOS app in SwiftUI
Before going Cross-Platform with your development, we will first create an iOS app. We will be starting with the app created during our work on the Using mock data for previews recipe in Chapter 4, Viewing while Building with SwiftUI Preview. The version created for this recipe will be made more modular to allow for code reuse across platforms, and the resources will not be stored in the preview section of the app.
The app will display a list of insects where you can click on any insect in the list to see more details about it. The data regarding the insects will be read from a JSON file and made available to our views using an @Environment
variable.
Getting ready
Let's create a new single-view iOS app in SwiftUI named Cross-Platform
.
How to do it…
We will set up the model and data source used in this recipe, and then proceed to create the views and subviews needed to display the list of insects and the details of each one....