SwiftUI: Why is my NavigationLink not updating the view hierarchy on iOS 17?
I am facing an issue with `NavigationLink` in a SwiftUI application on iOS 17 where the destination view is not updating as expected. When I tap on the `NavigationLink`, it seems to navigate to the new view, but the view hierarchy does not reflect the changes based on the updated state. Here is a simplified version of my code: ```swift import SwiftUI struct ContentView: View { @State private var selectedItem: Item? let items = [Item(name: "Item 1"), Item(name: "Item 2")] var body: some View { NavigationView { List(items, id: \ .name) { item in NavigationLink(destination: DetailView(item: item), tag: item, selection: $selectedItem) { Text(item.name) } } .onChange(of: selectedItem) { newValue in print("Selected item changed to: \ (newValue?.name ?? "nil")") } } } } struct DetailView: View { var item: Item var body: some View { Text("Detail for \(item.name)") } } struct Item { var name: String } ``` I've tried using both `tag` and `selection` on the `NavigationLink`, hoping it would handle the update correctly. Additionally, I verified that `selectedItem` is being updated correctly, as evidenced by the print statement in the `onChange` modifier. However, when I tap on an item, it navigates to the `DetailView`, but it doesn't seem to refresh or reflect any state changes unless I tap on the same item again. I also attempted to wrap my `DetailView` in a `@StateObject` to manage its state, but it didn't resolve the issue. The expected behavior is that tapping on an item should immediately show the corresponding detail view without needing to tap a second time. Is there a known issue with `NavigationLink` in iOS 17 or is there a specific way I should structure my code to achieve the desired navigation behavior?