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

handle route globally #93

Open
AlexanderBollbach opened this issue Apr 18, 2018 · 2 comments
Open

handle route globally #93

AlexanderBollbach opened this issue Apr 18, 2018 · 2 comments

Comments

@AlexanderBollbach
Copy link

AlexanderBollbach commented Apr 18, 2018

My understanding of NavigationState.route is that each of its RouteElementIdentifier elements corresponds to a Routable that is triggered. So if my route state goes from ["home"] to ["home", "favorites"] than the root Routable will push FavoritesVC (for example). So each successive RouteElementIdentifier that is appended during a SetRouteAction([] hands control off to a new Routable.

But what if I want to push a loading screen as the 3rd Routable. A loading screen could be presented from any VC. Is there a way to define the routing to a loading screen (say by presenting LoadingVC modally) once and have FavoritesVC inherit the ability? Because a ProfileVC along with 10 other VC's would reasonably present a loading screen.

@trentguillory
Copy link

I currently have this implemented, but my global view is a Menu. I approached this by making a protocol, MenuDelegate that requires the implementation of my showMenu() function. This function triggers access to the MenuVC just like any other view, and it can dismiss itself as well.

Would an approach like that work for your use case? This is a problem I'm trying to improve upon myself.

@AlexanderBollbach
Copy link
Author

AlexanderBollbach commented Jun 2, 2018

@trentguillory @mjarvis
i thought of another way to do this. but it would involve changing the library. looking at the source, (specifically Router<T>.routingActionsForTransitionFrom), if my routing state goes from ["foo"] to ["foo", "bar"], than the Routable pushed for "foo" is charged with routing to "bar". Is it possible to extend ReSwiftRouter such that the "bar" route could be handled only by the Routable for "foo"?

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