Issues with SwiftUI NavigationLink causing unexpected view re-renders in iOS 16
I'm trying to implement I've searched everywhere and can't find a clear answer. I'm working through a tutorial and I've tried everything I can think of but I'm experiencing unexpected behavior with `NavigationLink` in my SwiftUI app on iOS 16. The issue arises when I navigate to a detail view, and it seems to re-render every time I pop back to the previous view. This results in an unwanted flicker that disrupts the user experience. I have a view with a list of items, and each item is wrapped in a `NavigationLink` like this: ```swift struct ItemListView: View { @State private var items: [Item] = [] var body: some View { NavigationView { List(items) { item in NavigationLink(destination: ItemDetailView(item: item)) { Text(item.name) } } .onAppear { loadItems() } } } private func loadItems() { // Simulate loading items items = [Item(name: "Item 1"), Item(name: "Item 2")] } } ``` In my `ItemDetailView`, I am also using a `@State` variable to manage some local data: ```swift struct ItemDetailView: View { @State var item: Item var body: some View { VStack { Text(item.name) // Additional detail UI } } } ``` The flickering seems to happen when navigating back to `ItemListView`. I suspect it might have something to do with how SwiftUI handles view state or re-renders when the `List` is updated. I’ve tried using `@ObservedObject` for the list of items and applying `.id()` to the `List`, but the behavior persists. Does anyone have insights into why this flicker occurs, or suggestions on best practices for handling navigation in SwiftUI that could prevent this issue? For reference, this is a production service. Hoping someone can shed some light on this. Any suggestions would be helpful. I recently upgraded to Swift 3.9. I'd really appreciate any guidance on this.