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
Priyanshu Jain
09/03/2023, 5:57 AM
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