touchlab / KaMPKit

KaMP Kit by Touchlab. A collection of code & tools designed to get your mobile team started quickly w/Kotlin Multiplatform
https://touchlab.co/
Apache License 2.0
2.2k stars 199 forks source link

viewmodel expect/actual #238

Closed russhwolf closed 2 years ago

russhwolf commented 2 years ago

This is an alternate take on #231 that uses an expect/actual base class in order to avoid one layer of wrapper class on the Android side. This feels nicer in a greenfield context, but has less flexibility to deal with certain scenarios that can come up when migrating a pre-existing app to KMP, such as differences in what functionality is supported per platform, and usage of Android-specific APIs like LiveData.

kpgalligan commented 2 years ago

This PR is the merge of concepts from the various other view model PR's. Adding links here for reference.

https://github.com/touchlab/KaMPKit/pull/206 https://github.com/touchlab/KaMPKit/pull/217 https://github.com/touchlab/KaMPKit/pull/218 https://github.com/touchlab/KaMPKit/pull/231

samhill303 commented 2 years ago

You should update https://github.com/touchlab/KaMPKit/blob/main/docs/GENERAL_ARCHITECTURE.md with the new structure. Explaining the different layers of viewmodel on native side would be helpful

russhwolf commented 2 years ago

re readme updates, I think that'll come as part of the separate docs update pass we've been talking about