https://kotlinlang.org logo
Title
m

Michal Guspiel

05/03/2023, 6:43 AM
Hi, I’m not sure how to handle this: I am making a modular app in which I have features and core modules. Technically core modules shouldn’t be accessed by app entry point but rather in feature modules. I’m using Koin for dependency injection and some core modules like my data layer is initialized with Koin, so that I can inject it in my features. How should I start my koin modules? I could start them in each of the features but then I need to initialize the same object twice. Another option is to initilize it once in entry point but then my app entry point has a direct reference to core data module. Ideas?
c

curioustechizen

05/03/2023, 6:53 AM
You can use module includes (introduced in Koin 3.2): https://insert-koin.io/docs/reference/koin-core/modules#module-includes-since-32
m

Michal Guspiel

05/03/2023, 6:57 AM
That seems like a solution, great thanks!