Skip to content

Instantly share code, notes, and snippets.

@fvilarino
Last active September 18, 2023 18:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
MVI Framework - Counter ViewModel
class CounterViewModel(
// 1
reducer: CounterReducer = CounterReducer(),
// 2
) : MviViewModel<CounterState, CounterAction>(
reducer = reducer,
initialState = CounterState.initial,
) {
// 3
fun onDecrement() {
dispatch(CounterAction.Decrement)
}
// 4
fun onIncrement() {
dispatch(CounterAction.Increment)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment