Is there subcomponents or similar to Dagger subcom...
# koin
p
Is there subcomponents or similar to Dagger subcomponents in Koin? I want to be able to create these dependencies subgraph on the fly as the user browse the different sessions of the App. Similar to component dependency in Dagger. What is the closest approach?
I went through the documentation and scopes kind of get close but it is not quite the same.
a
What do you want to do exactly, without talking about subcomponent? Is it a visbility problem?
p
Hi Arnaud, thanks for replying, I’LL explain: I have a Tree of coordinators (I am trying to implement the coordinators pattern) where each node in the tree gets passed a Dagger Component/Subcomponent. Actual implementation is using Dagger Component dependency. Each Coordinator node is associated with a Builder that receive the parent component, then creates a new component to be provided to the child Coordinator. The new created Coordinator keeps an instance of its own Component and when it spawn a new child Coordinator, it will use its own Component as the parent. So on and So forth. It is a minimal/manual implementation of Uber RIBs basically. Now, I want to make the Builders/Coordinators independent of Dagger, so I could use any dependency injection solution out there. For that, I plan to abstract the Injection. But my main question is that, how I can create this per Coordiantor module/submodule or perhaps scope with Koin. Coordinator Builder function: https://github.com/pablichjenkov/MVVM-Coordinator/blob/fb853ab50ae7a8d9cdc91785955[…]in/java/com/intervalintl/onboard/OnboardCoordinatorBuilder.java Coordinator Builder function usage: https://github.com/pablichjenkov/MVVM-Coordinator/blob/fb853ab50ae7a8d9cdc91785955[…]/main/java/com/intervalintl/intro/IntroActivityCoordinator.java The idea is to split the dependency graph into small subgraphs that are created on the fly as the App is browsed. To be able to scope dependencies of the Coordinator to each corresponding subgraph.
BTW, just doing a cleanup on saved conversations after almost a year 😺. Just in case it helps someone else, the answer was `loadKoinModules`/`unloadKoinModules` .