Skip to content

Instantly share code, notes, and snippets.

@motorro
Created July 31, 2022 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motorro/703195958ca0f443bb730a55aee83d50 to your computer and use it in GitHub Desktop.
Save motorro/703195958ca0f443bb730a55aee83d50 to your computer and use it in GitHub Desktop.
LCE view model
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