-
-
Save saeedashrafy/8cf759bc8ee0b35b99f35a184eab0254 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeViewModel(private val getFoodsUseCase: GetFoodUseCase) : ViewModel() { | |
// intialize viewState | |
init { | |
val initialVS = ViewState.initial() | |
viewState = _intentFlow.toPartialStateChanges() | |
.scan(initialVS) { state, changes -> changes.reduce(state) } | |
.stateIn(viewModelScope, SharingStarted.Eagerly, initialVS) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment