Closed adam-hurwitz closed 3 years ago
hi! ViewModel is expect class - https://github.com/icerockdev/moko-mvvm/blob/master/mvvm/src/commonMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt
actual implementation on android is subclass of android's ViewModel - https://github.com/icerockdev/moko-mvvm/blob/master/mvvm/src/androidMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt as you already see.
actual implementation on ios is just class - https://github.com/icerockdev/moko-mvvm/blob/master/mvvm/src/iosMain/kotlin/dev/icerock/moko/mvvm/viewmodel/ViewModel.kt
info about expect/actual - https://kotlinlang.org/docs/reference/mpp-connect-to-apis.html
I understand the high-level concept now with expect/actual. Thanks for taking the time to share those classes and resources! 🙏🏻
In the ViewModel with send events to View example,
EventsViewModel
is implemented for the Android version as an Android component instance ofViewModel
.How does the
EventsViewModel
work for the iOS version since it cannot implement the same Android component instance ofViewModel
? Is there an alternative implementation ofViewModel
defined to run for iOS?