Hello, does someone have an example project of `ko...
# kotlin-inject
g
Hello, does someone have an example project of
kotlin-inject
used in in a Compose Multiplatform project?
m
I used it in my project here https://github.com/Suwayomi/Suwayomi-JUI Feel free to take from it 👍
s
I think one of the big examples is https://github.com/chrisbanes/tivi With a great usage of components with expect/actual for different platform implementation providers
also ki docs were recently updated for KMP, check them out
a
Hey @Mitchell Syer I'm taking a look at your sample, and I'm trying to figure out how you're injecting your ViewModels without using any type aliases? I see that you have
SharedViewModelComponent
with a number of VM-returning functions which attaches to the App compoenent. Are those code-gen'd by kotlin-inject to provide the dependencies such that they can be used in Compose?
m
They are! In each platform module I have a abstract class component that implements each interface, so Kotlin-Inject generates those interface implementations since they are part of the component. After that I provide that component using the LocalViewModelComponent composition local
a
Like this, on Android?
m
Exactly, that specific part is outdated and won't work exactly like that in the latest Voyager, but it's close enough for an example
a
Amazing, thanks for the help!