*How do I deal with Dagger when going multuplatfor...
# multiplatform
u
How do I deal with Dagger when going multuplatform? Obviously it cannot be in common, but I already have a project written and @Inject constructors everywhere Should I remove @Inject ctors and move to a @Module which would live in androidMain? Or is there a way to bend it so I don"t have to rewrite source? i.e. keep the @Inject annot. in common and somehow just expect actual it?
v
I have used
koin
DI which can be kept in commonMain.
u
I don't want to use koin
j
Any particular reason why?
u
It's subpar due to not being compile time checked
j
Very easy to add small unit test to check that
u
Any idea as how to deal with dagger? Can I expect actual the annotation and then just run dagger on android?
@John O'Reilly how would such test look like? do you mean to instantiate the graph and pull out a dependency and assert it doesn't crash?
j
u
thanks
e
You can check out kotlin-inject. Compile time checked, and similar to Dagger (with a simpler API surface IMO).
u
I'm aware. But I don't want to refactor whole codebase just to try KMM. I was thinking something like expect/actualing the Inject annotation, and then running dagger on android, and manual DI on ios
209 Views