pointfreeco/swift-navigation

Navigation can become broken

shalom-aviv opened this issue · 1 comments

Description

I pulled master with commit d9e72f3 and played with project example

Please check video:

Simulator.Screen.Recording.-.iPhone.15.-.2024-02-06.at.21.52.32.mp4

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

I can back to previous screen

Actual behavior

I can not back to previous screen

Steps to reproduce

Please check attached video

SwiftUI Navigation version information

d9e72f3

Destination operating system

iOs 17.2

Xcode version information

15.2

Swift Compiler version information

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

Hi @shalom-aviv, unfortunately this is just yet another bug in SwiftUI navigation and there's nothing we can really do about it. We tried working around some SwiftUI bugs, but honestly it's become a big pain to do so, and we probably should have never even attempted it.

In the case study you are seeing in particular, we had a workaround for bugs in navigationDestination that worked for iOS <16.4 and iOS 17+. It now seems this workaround is no longer correct for 17.2+ and so we technically should add another condition to that code.

Honestly this is all just getting untenable. I recommend using navigationDestination(isPresented:) directly in your code, and mimicking what our navigationDestination(unwrapped:) does directly in your code:

https://github.com/pointfreeco/swiftui-navigation/blob/d9e72f3083c08375794afa216fb2f89c0114f303/Sources/SwiftUINavigation/NavigationDestination.swift#L54-L56

Since this isn't an issue with this library I am going to convert it to a discussion.