Updating HighlightView
The first thing I will do is update the code to align with my coding standards; feel free to do the same. Now, we will add five state variables. One will be used to track whether an image has been clicked, and the other four will be used to pass data from the HighlightView
to the EnhancedView
. Add the code after the adaptive columns like so:
private let adaptiveColumns =[ GridItem( .adaptive( minimum: 300 ) ) ] @State private var isClicked: Bool = false @State private var imageFile: String = "" @State private var imageName: String = "" @State private var imageDate: String = "" @State private var imageDescription: String = ""
Now, update the body to match the following code:
var body: some View{ NavigationView { ScrollView { ...