https://kotlinlang.org logo
#koin-dev
Title
# koin-dev
g

Gustavo Barbosa Barreto

10/06/2023, 11:29 AM
Hello! I'm developing a feature with Koin as DI and here we are using some clean architecture concepts, so I've got a doubt. We have one module per Fragment to provide their dependencies, one module to the Data layer, and another to the Domain layer. In this way, to share the dependencies from the domain and data layers with the fragments (presentation layer), do I need to use the "shared module" approach or only the "module includes" as shown in the Koin doc? I'm asking, because when I was reading the documentation about shared modules, I got confused if shared modules could be the best approach to sharing dependencies.
p

Pedro Francisco de Sousa Neto

10/06/2023, 12:56 PM
I think this part of doc is talking about optimization and not about sharing modules. Can you help us clarify this point, @arnaud.giuliani?
a

arnaud.giuliani

10/06/2023, 2:42 PM
I see yes, it's quite confusing. The simplest way to reuse modules is to use
includes
function from the DSL. Up to you to find the right granularity in terms of number of Koin modules.
this way of
sharedModule
was in some first versions of KMP (seems outdated then)
g

Gustavo Barbosa Barreto

10/06/2023, 7:20 PM
I found some typos, so I did a fork and opened a pull request with fixes. PR Link: https://github.com/InsertKoinIO/koin/pull/1670
1
p

Pedro Francisco de Sousa Neto

10/06/2023, 9:05 PM
Reviewed and approved
👊 1
a

arnaud.giuliani

10/09/2023, 11:57 AM
thans @Gustavo Barbosa Barreto @Pedro Francisco de Sousa Neto, I will take a look 👍
👍 1
g

Gustavo Barbosa Barreto

10/09/2023, 12:20 PM
@arnaud.giuliani, I'll open other PR with suggestion to avoid these doubts, considering your explanation. 👊 Thanks for your help.
👍 3