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

Question: Tight coupling with Navigation #105

Open
nugmanoff opened this issue Jul 15, 2023 · 4 comments
Open

Question: Tight coupling with Navigation #105

nugmanoff opened this issue Jul 15, 2023 · 4 comments
Labels
question Further information is requested

Comments

@nugmanoff
Copy link

Hey! Thanks for an amazing library, you did a tremendous job!

IMO Nivelir has one of the most well-designed APIs I've come across as an Apple platforms developer, especially given the amount of complexities it hides. Abstractions are well-thought and on-point. 🤌

I am considering to use Nivelir for my next project, because I found myself solving the same problems when doing the complex global routing, but one thing I am concerned about is tight coupling between ViewControllers/Views and Navigation by invoking navigation actions directly from ViewControllers/Views. Basically the problem that Coordinator pattern is intended to solve.

I do understand that this library is not opinionated about where to invoke navigation actions (which it makes it even more cool) and it can perfectly be abstracted and delegated away to Coordinator or other assisting entities.

The question is – what is your take on it? How are you dealing with your Presentation Layer (VC/View) "knowing too much" about Navigation? Or you simply don't focus on it and it works fine for you and you don't overstretch with abstractions here by introducing something like Coordinators?

Thanks!

@almazrafi
Copy link
Collaborator

Hello 👋

Thank you very much for your feedback. We are very glad that you liked Nivelir.

Regarding the issue of using Nivelir directly from ViewController, we do this only in simple modules of the demo project.
In our real project, we allocate a separate Router entity for each module, in which all navigation actions are performed.

There are no restrictions for using Nivelir with the Coordinator pattern, on the contrary, it will help you get rid of a lot of boilerplate code.

In our project, we do not use the Coordinator template, but we have "Logic" modules that can resemble them.
The difference between these approaches is that Logic modules do not own the container (UIViewController or UIWindow),
but receive it from the outside from regular (MVC, MVVM ) or other logic modules.
Also logic modules have no hierarchy and control only a small part of ephemeral navigation (for example, a sequence of authorization steps).
This allows us to decompose large Flows into small reusable stages.

Thanks!

@almazrafi almazrafi added the question Further information is requested label Jul 18, 2023
@nugmanoff
Copy link
Author

nugmanoff commented Jul 18, 2023

Thanks for your thorough answer! It makes total sense. I now have even more questions😅
I hope that you don't mind me asking them.

Would you be able to provide simplified version of your "Logic" modules/Router entities?

I am especially curious about how you do the container passing between logic modules and how you wire all of these together.

Another big question is who creates/initiates – who creates screens, who creates logic modules/routers, how ViewController talk to these additional navigation entities?

@almazrafi
Copy link
Collaborator

We will try to prepare for you a mini-project that is similar in structure to ours 👌

@nugmanoff
Copy link
Author

nugmanoff commented Jul 21, 2023

Thanks man!! You really don't have to do that, you are too kind🙏

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

No branches or pull requests

2 participants