navigationDestination + NavigationPath broken on iOS 17

Using the new navigationDestination and NavigationPath functions previously on iOS 16 everything has been working fine using a custom back button, which calls path.removeLast().

However, if we try this on iOS 17, the screen being removed flashes white.

You can try this code as an example (NOTE THE WHITE FLASH ON REMOVE LAST):

struct DetailView: View {
    @Binding var path: NavigationPath

    var body: some View {
        ZStack {
            Color.black
            VStack(alignment: .center) {
                Spacer()
                Button(action: {
                    path.removeLast()
                }, label: {
                    Text("BACK")
                })
                Spacer()
            }
        }
    }
}

struct ParentView: View {
    @State var path: NavigationPath = .init()

    var body: some View {
        NavigationStack(path: $path) {
            ZStack {
                Color.red
                VStack(alignment: .center) {
                    Spacer()
                    Button(action: {
                        path.append("TEST")
                    }, label: {
                        Text("FORWARD")
                    })
                    Spacer()
                }
            }
            .navigationDestination(for: String.self) { _ in
                DetailView(path: $path)
            }
        }
    }
}

Any work arounds? Suggestions?

After 20 years, Apple Devs cannot get basic navigation right. Horrendous. Poor effort SwiftUI developers! Damn! Going to be pushing this through all channels, YouTube, Facebook etc... Unacceptable.

I've done a small YouTube video about this issue.

A little more insight into the context of the issue here -> https://www.youtube.com/watch?v=0YxMo_YfDnU

This has been fixed in iOS 17.1, thank you for filing the feedback (as I saw from your other post)

navigationDestination + NavigationPath broken on iOS 17
 
 
Q