https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Rohan Maity

01/29/2022, 9:08 AM
Hello, is there any Dependency Injection library which could be used for Multi-platform project target android, Web (JS), iOS and desktop ?
m

Mustafa Ozhan

01/29/2022, 9:08 AM
koin, kodein
☝️ 1
r

Rohan Maity

01/29/2022, 9:09 AM
Koin supports JS and desktop Target as well ? Same question for kodein
m

Mustafa Ozhan

01/29/2022, 9:10 AM
koin for sure because I use it , not sure about kodein but I remember like that
r

Rohan Maity

01/29/2022, 9:11 AM
Sweet, I have some experience with koin for Android only. Do you have any good article for Using koin on Multi-platform ?
m

Mustafa Ozhan

01/29/2022, 9:23 AM
Not really sorry 🙂
r

Rohan Maity

01/29/2022, 9:48 AM
So it available in their documentation right at least ?
a

Alejandro Rios

01/29/2022, 3:05 PM
Here is another option, but not sure if will support all that you need https://link.medium.com/vfX0T5Rtkmb
m

Marko Novakovic

01/29/2022, 4:03 PM
I tried DI.kt for Android and iOS, it’s nice library
r

Rohan Maity

01/29/2022, 4:04 PM
I need it for Js and desktop as well
j

John O'Reilly

01/29/2022, 4:07 PM
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

Rohan Maity

01/29/2022, 4:16 PM
Oh will try to use koin in JS and desktop target
I am mostly concerned about JS target
j

John O'Reilly

01/29/2022, 4:17 PM
there's a #koin channel btw if you need to ask specific questions about it
r

Rohan Maity

01/29/2022, 4:19 PM
Mainly regarding JS target
But will try first and then ask question for the problem I will face in future
j

John O'Reilly

01/29/2022, 4:22 PM
fwiw https://github.com/joreilly/PeopleInSpace includes 2 JS clients....one uses Compose for Web and the other using Kotlin/JS + React wrapper
r

Rohan Maity

01/29/2022, 4:27 PM
Oh so it does DI with koin in it ?
j

John O'Reilly

01/29/2022, 4:28 PM
correct
r

Rohan Maity

01/29/2022, 4:29 PM
Oh neat. That's actually good example
g

georgi

01/29/2022, 11:41 PM
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

Derek Ellis

01/30/2022, 5:05 PM
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

Rohan Maity

01/31/2022, 3:41 AM
oh cool, I will look into kotlin-inject and see it usage Thanks for this
15 Views