InsertKoinIO / koin

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

Feature Request: Allow instances to be reused, but also garbage collected #1378

Open ankushg opened 2 years ago

ankushg commented 2 years ago

It's great that we have some flexibility between factory and singleton!

At the same time, we have many classes that could be reused if they already exist, without a strong need to only have one single instance.

It would be great if we could tell Koin to

This is similar to Dagger's @Reusable scope.

arnaudgiuliani commented 1 year ago

Yep, something like with weak references to garbage it if nobody has nay reference on it 🤔

lcszc commented 10 months ago

Any plans on when this will get added? It's been 1y+

Swinject already has this feature as well and I believe it is a must-have, otherwise we would need to be hacking around scopes.

arnaudgiuliani commented 9 months ago

yes, it's something that need a bit of rework for internal engine

tamimattafi commented 4 weeks ago

Are there any updates on this?