SwiftUI NavigationLink in List

Hi,

There seems to be a performance issue or bug with NavigationLinks in a List, whenever the user scrolls "fast" over multiple rows over. Without a NavigationLink, the below example prints the indices in the console in right order, however, with a NavigationLink, the indices are not updated correctly, and e.g. fast scrolling from row 20 to 70 doesn't update any value.

More specifically, this is an issue with List rows using AsyncImage with placeholders, where the list doesn't update the specified row, and therefore still shows the placeholder image. To then update the image, the user has to interact anywhere on the screen.

I am using the newest XCode version and am using iOS 16. I can replicate it in the Simulator as well as on my iPhone.

NavigationStack {
            List(0...100, id: \.self) { index in
                NavigationLink(value: index) {
                    Text(index.description)
                        .onAppear {
                            let _ = print(index, " appearing")
                        }
                        .onDisappear {
                            let _ = print(index, " disappearing")
                        }
                }
            }
        }

Replies

Apologies, here is the complete code block for the example:

struct ContentView: View {
    var body: some View {
        NavigationStack {
            List(0...100, id: \.self) { index in
                NavigationLink(value: index) {
                    Text(index.description)
                        .onAppear {
                            let _ = print(index, " Appearing")
                        }
                        .onDisappear {
                            let _ = print(index, " Disappearing")
                        }
                }
            }
        }
    }
}