Created
July 31, 2022 16:38
-
-
Save motorro/703195958ca0f443bb730a55aee83d50 to your computer and use it in GitHub Desktop.
LCE view model
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 LceViewModel : ViewModel() { | |
private fun initStateMachine(): CommonMachineState<LceGesture, LceUiState> = ItemListState() | |
private val stateMachine = FlowStateMachine(::initStateMachine) | |
val state: SharedFlow<LceUiState> = stateMachine.uiState | |
fun process(gesture: LceGesture) { | |
stateMachine.process(gesture) | |
} | |
override fun onCleared() { | |
stateMachine.clear() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment