-
public interface MavericksViewModelFactory<VM extends MavericksViewModel<S>, S extends MavericksState>Implement this on your ViewModel's companion object for hooks into state creation and ViewModel creation. For example, if you need access to the fragment or activity owner for dependency injection.
-
-
Method Summary
Modifier and Type Method Description VMcreate(ViewModelContext viewModelContext, S state)SinitialState(ViewModelContext viewModelContext)The initial state for the ViewModel. -
-
Method Detail
-
create
VM create(ViewModelContext viewModelContext, S state)
- Parameters:
viewModelContext- ViewModelContext which contains the ViewModel owner and arguments.state- The initial state to pass to the ViewModel.
-
initialState
S initialState(ViewModelContext viewModelContext)
The initial state for the ViewModel. Override this if the initial state requires information from arguments, or the ViewModel owner. This function will take precedence over any secondary constructors defined in the state class, S.
The return value of this function will be transformed with any PersistState values before being used in create.
-
-
-
-