Anyone use koin in kmp with kmp viewmodels (like t...
# koin
c
Anyone use koin in kmp with kmp viewmodels (like the kmp viewmodel that precompose has)? Really curious how to get koin migrated to kmp ViewModels 😅
p
Based on what I understood, view models are defined as follows in your koin module:
Copy code
factory{ ExampleViewModel() }
and are referred by
Copy code
//Using this approach because  inline Compose function do not work for Kotlin/Native target (like iOS), and seems like a compiler bug

val viewModel = koinViewModel(ExampleViewModel::class)
You will have to add the following dependency for koin in your common module's commonMain sourceSet
Copy code
api("moe.tlaster:precompose-koin:$precompose_version")
c
thanks. i will give that a shot