-
Notifications
You must be signed in to change notification settings - Fork 65
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
Manage navigation manually #24
Manage navigation manually #24
Conversation
@johnpatrickmorgan not sure if |
7901bda
to
b88109c
Compare
Thanks for raising this PR. This gives me a much clearer idea of the behaviour you wanted. It's a very interesting approach, and I think it fits nicely with some changes that I'm investigating for issue #21: I think the ability to customize the transition when 'manually navigating' would be very useful. If I can make the changes as I hope, it would allow for an API something like this: routes.replaceCurrentScreen(with: .home, transition: .push) Which would swap out the current screen for The changes I'm looking into making for #21 involve a pretty major rewrite of |
@johnpatrickmorgan thanks for the review. Since you're rewriting Here I list out what I hope the next FlowStacks / TCACoordinators can achieve: Problem:
How FlowStacks can solve the above problems:
A user can push a screen that uses 'manual' navigation if they specify it in the
A user can further push any screen without specifying if the last one is native or not, the library can infer it based on the last element's attribute
Let's see if the above points make sense. Besides, if we take a step back, navigation boils down to transition of one screen to another. Hence no matter how deep one's route stack is, when one pushes / presents / overlays a new screen, what the app user sees is the interaction between current screen and next screen. And this is the gist of this PR as well. |
Just a quick update: the latest version of SwiftUI allows stack-based navigation on macOS, albeit only for version 13 onwards, so there is a bit less motivation for this sort of change. I also realised that this approach differs from other forms of navigation in that moving back to a previous screen recreates the screen, re-initialising its state, which might be unexpected. |
Thanks for taking a look into this @johnpatrickmorgan, I will close the PR. |
This PR:
manualNavigation
toRoute
that allows user to create their own navigation flow without using Apple's nativeNavigationView
Manual
to demonstrate usingmanualNavigation
in both iOS and macOSThis addresses issue #22
iOS:
Simulator.Screen.Recording.-.iPad.9th.generation.-.2022-04-25.at.16.28.57.mp4
macOS:
Screen.Recording.2022-04-25.at.4.30.02.PM.mov