Hello, is there any Dependency Injection library w...
# multiplatform
r
Hello, is there any Dependency Injection library which could be used for Multi-platform project target android, Web (JS), iOS and desktop ?
m
koin, kodein
☝️ 1
r
Koin supports JS and desktop Target as well ? Same question for kodein
m
koin for sure because I use it , not sure about kodein but I remember like that
r
Sweet, I have some experience with koin for Android only. Do you have any good article for Using koin on Multi-platform ?
m
Not really sorry 🙂
r
So it available in their documentation right at least ?
a
Here is another option, but not sure if will support all that you need https://link.medium.com/vfX0T5Rtkmb
m
I tried DI.kt for Android and iOS, it’s nice library
r
I need it for Js and desktop as well
j
I wrote short article about using Koin in KMP project some time ago but think it mostly still applies....in case it helps https://johnoreilly.dev/posts/kotlinmultiplatform-koin/ Also using it in most of samples at https://github.com/joreilly
r
Oh will try to use koin in JS and desktop target
I am mostly concerned about JS target
j
there's a #koin channel btw if you need to ask specific questions about it
r
Mainly regarding JS target
But will try first and then ask question for the problem I will face in future
j
fwiw https://github.com/joreilly/PeopleInSpace includes 2 JS clients....one uses Compose for Web and the other using Kotlin/JS + React wrapper
r
Oh so it does DI with koin in it ?
j
correct
r
Oh neat. That's actually good example
g
The other day someone mentioned kotlin-inject but I have not tried it out in a KMM project yet - https://github.com/evant/kotlin-inject In my experience, Kodein and Koin work quite well even though Koin’s setup is a bit more involved and has limitations when you have a multi-module project. There's also Popkorn which looked promising but don't believe it's maintained anymore. There's also a channel #popkorn where I've asked about it but have had no response yet unfortunately.
d
kotlin-inject is nice if you're specifically looking for that Dagger-like compile-time validation and codegen. I tried it recently with a Kotlin/JS project (with compose-web) and I was quite happy with it. https://github.com/dellisd/reroute
🙌 2
r
oh cool, I will look into kotlin-inject and see it usage Thanks for this