Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues caused by use of SwiftUI's NavigationStack #115

Open
sgade opened this issue Jan 11, 2023 · 2 comments
Open

Issues caused by use of SwiftUI's NavigationStack #115

sgade opened this issue Jan 11, 2023 · 2 comments

Comments

@sgade
Copy link

sgade commented Jan 11, 2023

When targeting iOS 16 and above, the use of NavigationView is deprecated (since iOS 16.2 and similar). Stinsen internally uses NavigationView (in its NavigationViewCoordinator) in combination NavigationLink for navigation.
This implementation detail came up as an issue in a custom ViewWrapperCoordinator that was doing if #available checks for iOS 16 and then using SwiftUI's NavigationStack instead.

Environment

  • iOS 16.2 / Xcode 14.2
  • Stinsen 2.0.13

Problematic behaviour

The problem is that the dismissal of views and coordinators is broken with the approach described above. Inconsistent behaviour and white screens are symptoms. The console also frequently shows the warning: NavigationLink presenting a value must appear inside a NavigationContent-based NavigationView. Link will be disabled..

Presentation of views and coordinators actually works just fine, as far as I can tell.

Proposed changes

I know Stinsen strives to be backward very compatible. Coming from iOS 13, there is a long way until the minimum supported version will be iOS 16. Even then, NavigationView still works the same as in previous versions of iOS.

However, it would still benefit users if there was support for the new navigation types, as it would make integrating more current implementations much easier and familiar going forward.
As NavigationView is still widely used, there could be an option to either use the old or new version.

At the very least it would be very helpful if there was a hint (e.g. in the README) that custom ViewWrapperCoordinators for stack-based navigation should use NavigationView instead of NavigationStack.

Let me know what direction you would prefer and if I could be of any help.

@sgade sgade changed the title SwiftUI 4 compatibility and the use of NavigationStack Issues caused by use of SwiftUI's NavigationStack Jan 11, 2023
@LePips
Copy link
Collaborator

LePips commented Jan 11, 2023

The requirement for moving to the new APIs isn't unknown, it just ... hasn't happened yet

@sgade
Copy link
Author

sgade commented Jan 11, 2023

Thanks for the quick reply and for referring to the existing discussion. I didn't expect the topic to be in the comments to that issue but now I read it.

Are there any updates on the topic?
I think the suggested Backport solution might make it somewhat manageable to keep both implementations around for the foreseeable future.

Also, do you want to keep tracking the progress in the other ticket? Then I'll close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants