TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SwiftUI broken NavigationPath as of iOS 17. Not fixed as of release of GM 17.0

Forums > SwiftUI

Can someone escalate this huge issue to Apple SwiftUI devs... not idea how this got out into iOS 17 GM ->

Have raised an issue with Apple via feedback assistant.

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 when calling path.removeLast()):

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

2      

I've decided to escalate this.

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

2      

@letto  

Same issue. Thought I can finally use SwiftUI to build navigation but now I see it's never gonna happen.

2      

Fixed in iOS 17.1

2      

Hacking with Swift is sponsored by Blaze.

SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!

Reserve your spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.