Why Koin #66
|
Hi. My question is specifically regarding why this project is tightly coupled to Koin. While koin can be used as a dependency injection system that works with KMP, it should not be necessary to setting up the object graphs/factories necessary for this library, and it would make this library more accessible for other library authors (who don't want their libraries to be transitively dependent upon koin). Are there any plans to remove it? |
Replies: 3 comments 1 reply
|
You're right, and it's already fixed on a branch. How it got here: Koin wasn't a design decision, it was inheritance. This started as a Compose Multiplatform demo app that used Koin for its own DI. When the background-task code was extracted into a publishable module (v2.1.0), the You're right on the facts. I checked the published 3.2.0 metadata rather than answering from memory: Removal turned out cheap. The module used no container feature — no scopes, no qualifiers, no lazy graph. Everything meaningful ran at module-construction time and every wired class was already public. It's now a plain internal registry of Landing in 3.3.0, not a 4.0.0 as I first sketched — deprecating
#67 drops Porting the wiring also surfaced a real bug: on iOS, Thanks for pushing on this — it's the kind of thing that only gets fixed when someone outside the project asks. |
|
Thanks for answering the question. It would be great to use this library. My team has tested it, and it works for our purposes--just has the one negative side-effect mentioned above. I'm glad you're working on decoupling koin. Any idea on when a new version will be published? |
|
Shipped in v3.3.0.
Confirmed against the actual published metadata this time, not just the source: Two things worth knowing if you're upgrading:
Thanks again for pushing on this. |
You're right, and it's already fixed on a branch.
How it got here: Koin wasn't a design decision, it was inheritance. This started as a Compose Multiplatform demo app that used Koin for its own DI. When the background-task code was extracted into a publishable module (v2.1.0), the
KoinModule.kttrio came along with it. Then v2.2.2 fixed the worst symptom — the library called globalstartKoin, which crashed any host app that already had Koin — by switching Android to a private isolatedkoinApplication. That fixed the crash but only on Android, which is why the coupling you hit is lopsided.You're right on the facts. I checked the published 3.2.0 metadata rather than answering from memory:
k…