Max Kachinkin
02/27/2023, 4:34 PMMax 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 DIMax Kachinkin
02/28/2023, 5:12 PMclass MyInitializer : Initializer<Unit> {
override fun create(context: Context) {
val module = DI.Module("myModule") {
...
}
((context as DIAware).di as ConfigurableDI).addImport(module)
}
}
Max Kachinkin
02/28/2023, 5:15 PMMax Kachinkin
02/28/2023, 5:16 PMrocketraman
02/28/2023, 5:22 PMSet
bindings.rocketraman
02/28/2023, 5:25 PMnew
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.Max Kachinkin
02/28/2023, 5:31 PMbind<Repository>() with singleton { new(::RepositoryImpl) }
I write this:
bind<Repository>() with singletonOf(::RepositoryImpl)