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

Issue 161: MVVM -> MVI, LiveData -> StateFlow #162

Closed brady-aiello closed 3 years ago

brady-aiello commented 3 years ago

[Summary] MVI helps maintain a single source of truth for the state of the view overall (error, loading, success, empty).

StateFlow obviates LiveData with more capabilities along with multiplatform support, unlike LiveData.

[Fix] Add a DataState sealed class to model the view state, add Android lifecycle-ktx to collect the StateFlow in the MainActivity with lifecycleScope. Transform DataState from a sealed class in Kotlin shared to an enum in Swift.

[Testing]

https://github.com/touchlab/KaMPKit/issues/161

ben-whit-ley commented 3 years ago

Looks good to me 👍