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

Why does the Router own the RIB rather than the Interactor? #527

Open
aurelienp opened this issue Nov 27, 2022 · 0 comments
Open

Why does the Router own the RIB rather than the Interactor? #527

aurelienp opened this issue Nov 27, 2022 · 0 comments

Comments

@aurelienp
Copy link

aurelienp commented Nov 27, 2022

From a memory perspective, the Router is the owner of the RIBs, in the sense that it keeps a strong reference to the Interactor. This choice feels counter-intuitive to me and I would love to know more about the motivations behind it.

The interactor decides and speak imperatively to the router. Talking imperatively to a property that is weakly retained is not something that people are used to imo. There's nothing fundamentally wrong with it but I think the learning curve would be slightly less steep if RIBs stuck to what people are used to, especially considering all other weakly-retained "listeners" in other parts of a RIB stick to this convention.

I read in the documentation that returning the Router is a way to add an extra layer to encourage Rx streams rather than imperative communication to a child RIB. It seems worse to talk to a router directly since it means by-passing a RIB altogether. Though maybe this is less tempting to developers?

Personally, I would rather imagine RIBs to attach/detach interactors, re-inforcing the fact that interactors are the core of a RIB in a business-logic-driven world. It would mean having the router return a tuple in RIB with a view: an interactor and a UIViewController. And maybe that's the actual main reason for this choice: avoid to rely on tuples?

@aurelienp aurelienp changed the title Why does the Router own the RIB rather than the interactor? Why does the Router own the RIB rather than the Interactor? Nov 27, 2022
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

1 participant