NavigationPath and navigationDestination with custom back button fails on iOS 17 BETA

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 BETA 5, the screen being removed flashes white.

Also, how can I raise this as a bug with Apple, so they can fix it before the release of iOS 17.

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)
            }
        }
    }
}

NOTE: I have sent this as a bug report on Feedback Assistant -> FB12962660

Still not fixed in RC Candidate! Come on APPLE!?

Ugh! I'm seeing this behavior too and it's driving me nuts. In ios 16, the view.onDisappear doesn't get called until after the pop animation completed. in iOS 17, it gets called as soon as I call the pop, which indicates the view is being deallocated immediately. I've tried lots of changes so far to try to avoid this but no luck yet.

Fixed in iOS 17.1

I'm still seeing it, but it's interesting:

On device (iOS 17.2.1) or Simulator (iOS 17.2), the back button doing a navigationPath.removeLast doesn't work for me.

But on the Preview inside of Xcode (15.1), it works fine.

I checked my build settings: iOS deployment target=17.2.

Nothing helps ...

navigationDestination is still very buggy on 17.3. it doesn't register the first change to the NavigationStack(path:) binding...

NavigationPath and navigationDestination with custom back button fails on iOS 17 BETA
 
 
Q