-
Notifications
You must be signed in to change notification settings - Fork 3
6.1. StateView
Gabriel Brasileiro edited this page Jun 13, 2020
·
5 revisions
StateView<State> is a contract containing the method to get the state LiveData will be listened in your View.
BaseViewModel and StateViewModel implements this interface to can use the onStateChanged extension.
If you would like create a customized StateViewModel all you need is implements this interface.
Example:
abstract class StateViewModel<S : State, SE : StateEvent>(
private val reducer: Reducer<S, SE>
) : StateView<S>, ViewModel() {
override fun getState(): LiveData<S> = reducer.getState()
[...]
}