Hello everyone,
I'm currently working on a SwiftUI project as part of the "100 Days of SwiftUI" challenge, and I'm facing an issue with the NavigationLink. I have a list view where each row should navigate to a detail view when tapped, but nothing happens when I tap on the rows.
Here's the code I'm using for the NavigationLink:
scss
Copy code
struct ContentView: View {
var body: some View {
NavigationView {
List {
ForEach(items) { item in
NavigationLink(destination: DetailView(item: item)) {
Text(item.name)
}
}
}
.navigationTitle("Items")
}
}
}
I have confirmed that the items array is populated with the correct data, and the DetailView is properly implemented. However, when I tap on a row, the destination view doesn't appear.
Am I missing something in my code or overlooking any requirements for NavigationLink to work properly? Any help would be greatly appreciated.
Thank you in advance!
Best regards,
The Toilet Helper