Replies: 3 comments
-
On this note, I've been wondering: Why do the following at all when aggregation is done for us automatically based on project dependencies? internal interface AppGraph :
PlatformAppGraph,
ApiGraph,
SearchGraph,
...
{
} In my Android project with ~140 modules, I have one tl;dr: Why would you manually list the graph interfaces to extend at all instead of simply using the following and letting aggregation take care of it based on the projects pulled into the compile classpath? 👀 @DependencyGraph(AppScope::class)
internal interface MyGraph { ... } |
Beta Was this translation helpful? Give feedback.
-
Interesting, I've only really used vanilla Dagger (w/ Hilt) and Koin in the past so not really familiar with aggregation but will give it a go! I was also chatting to Claude (the AI) about it, which suggested using aggregation within layers – e.g. using |
Beta Was this translation helpful? Give feedback.
-
It sounds like @BindingContainers from the new release might be exactly what I want! Thanks @ZacSweers Would be helpful to update/add samples to use some of this stuff and have a more complex reference to look at 🙏 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We're using Metro in a brand new KMP-based app that is going to have Android and iOS targets, and was wondering what's the "best" (recommended) way to build up the dependency graph in a non-trivial modularized codebase.
The goal is to have distinct classes, that would live in different modules, that each provide bindings for their respective bits of the app. e.g.
ApiGraph
, a core module;SearchGraph
, a data module that needs a HttpClient provided by the ApiGraph; and then anAppGraph
to pull it all together.Where the
AppGraph
is also the boundary/entry-point for the KMP shared module, because we're still using Dagger (Hilt) in the Android module.Currently I've taken some inspiration from Tivi – which uses kotlin-inject – and have something like this:
and then this for my actual (Android) graph implementation:
This seems to be working fine, but I guess I'm wondering whether I'm missing anything and maybe I should be using graph extensions instead? And some help with what that might look like 🙏
If it makes a difference I think we would like to do some proper scoping at some point – e.g.
@UserScope
when logged in and then providing different http client bindings etc.Beta Was this translation helpful? Give feedback.
All reactions