https://kotlinlang.org logo
#android
Title
# android
a

Andy Gibel

01/29/2023, 6:22 PM
Hey folks! Just a general question on DI best practice. If you have multiple modules and best practice is to prefer pure kotlin modules where possible, so you people generally use hand rolled di there and Hilt in Android modules? Or is a Koin/hilt mix common?
s

Sam

01/29/2023, 7:40 PM
All my code apart from pure UI at this point is in common code, so hilt at the android level would be useless for me, there's just no need, so I just use koin everywhere
c

Colton Idle

01/29/2023, 11:54 PM
Might get more comments in #dagger?
a

Andy Gibel

01/29/2023, 11:55 PM
Thanks. Started to feel like Hilt is just the training wheels android DI that is meant to be discarded after your project grows 😛
👍 2
c

Colton Idle

01/29/2023, 11:56 PM
I think my last 10 projects have all used hilt so we haven't really moved away from it, but id be interested to see if we ever do move away from it
a

Andy Gibel

01/29/2023, 11:57 PM
Do you just use dagger in pure kotlin modules? Or are these projects not large enough to merit modularization?
c

Colton Idle

01/29/2023, 11:58 PM
i typically just use it in the app module unfortunately because theres always issues when it comes to multi module and DI. 🙃
r

rook

01/30/2023, 3:14 PM
Koin and Hilt/Dagger are different. If you’re having multi-module DI issues with Dagger, it’s usually a config issue. Anvil could be of use to you in that regard.
t

Tung97 Hl

01/31/2023, 7:03 AM
I use Koin for the KMP project because it is easy to set up and use. I think we shouldn’t mix two DI libraries for consistency.
👍 1
7 Views