Max Kachinkin
02/27/2023, 4:34 PMian.shaun.thomas
02/27/2023, 4:39 PMrocketraman
02/28/2023, 2:39 PMConfigurableDI
i.e. what use case does it solve?Max Kachinkin
02/28/2023, 5:10 PMaddConfig
, addImport
) my DI in Android Initializers. It is from androidx.startup package.
Separate Android module can have it’s Initializer and on creating itseft it can add it’s dependencies to DIclass MyInitializer : Initializer<Unit> {
override fun create(context: Context) {
val module = DI.Module("myModule") {
...
}
((context as DIAware).di as ConfigurableDI).addImport(module)
}
}
rocketraman
02/28/2023, 5:22 PMSet
bindings.new
function recently added, inspired by Koin), Seems relatively performant at startup time, though I wonder if KSP could help improve this even more in the future by moving some runtime init to compile time.Max Kachinkin
02/28/2023, 5:28 PMnew
API that you suggested earlier! Thanks for this!) Yesterday I simplified my bindings with it.bind<Repository>() with singleton { new(::RepositoryImpl) }
I write this:
bind<Repository>() with singletonOf(::RepositoryImpl)