Every time a row is selected the system decides to forward a random index to the next view.
Please look at the following video for clarification:

Below is the code:
struct TestView: View {
let columns = [
GridItem(.flexible())
]
@State var showDetail = false
var body: some View {
ScrollView {
LazyVGrid(columns: columns, spacing: 20) {
ForEach(1...10, id: \.self) { index in
Text("\(index)")
.background(NavigationLink(destination: TestDetail(index: index), isActive: $showDetail) {
EmptyView()
}).onTapGesture {
showDetail = true
}
}
}
}
}
}
struct TestView_Previews: PreviewProvider {
static var previews: some View {
TestView()
}
}
struct TestDetail: View {
var index: Int
var body: some View {
Text("\(index)")
}
}