InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
8.76k stars 695 forks source link

Add composable SubComponents injection and Decompose integration #1857

Closed antoniovm closed 1 month ago

antoniovm commented 2 months ago

Hi there, I've been recently working on a large project that requires a large dependencies injection management, and I've encountered the need of having the possibility of loading those modules dynamically, only where they are being used, particularly using Decompose. Since I have not found this feature in the repo, I have taken the liberty of proposing it here.

So basically I have created a new gradle module called koin-decompose, that tries to mymic dagger-android concept.

First of all I'd like to thank @arkivanov for his amazing job on Decompose, but also @juanlubf for helping to start the foundations of Koin with Decompose in that project.

And last but not least, of course thanks to @arnaudgiuliani for make Koin happen. So this is my humble contribution to he project, if you believe it makes sense and it could be helpful for the community

  1. Include Koin SubComponents using Compose
  2. Integrate with Decompose

There is a detailed explanation in the readme file here, but as a summary the goal of this contribution is to be able to navigate through the app and easily create/destroy dependencies modules only when needed, so a better memory managment is achieved.

Again thank you very much, and let me know what do you think. All namings, packages, arguments, etc.. are open to be changed if needed, so please do not hesitate on providing feedback about it.

Kind regards, Antonio