-
public interface ViewModelDelegateFactoryThis is invoked each time a Fragment accesses a ViewModel via the Mavericks extension functions (eg fragmentViewModel, activityViewModel, existingViewModel).
It allows global callbacks for when a view model is instantiated, with control over how the view model state should be instantiated.
-
-
Method Summary
Modifier and Type Method Description abstract <S extends MavericksState, T extends Fragment, MavericksView, VM extends MavericksViewModel<S>> Lazy<VM>createLazyViewModel(T fragment, KProperty<?> viewModelProperty, KClass<VM> viewModelClass, Function0<String> keyFactory, KClass<S> stateClass, Boolean existingViewModel, Function1<MavericksStateFactory<VM, S>, VM> viewModelProvider)Create a Lazy ViewModel for the given Fragment. -
-
Method Detail
-
createLazyViewModel
abstract <S extends MavericksState, T extends Fragment, MavericksView, VM extends MavericksViewModel<S>> Lazy<VM> createLazyViewModel(T fragment, KProperty<?> viewModelProperty, KClass<VM> viewModelClass, Function0<String> keyFactory, KClass<S> stateClass, Boolean existingViewModel, Function1<MavericksStateFactory<VM, S>, VM> viewModelProvider)
Create a Lazy ViewModel for the given Fragment.
- Parameters:
existingViewModel- If true the view model is expected to already exist, so a new one should not need to be created.viewModelProvider- This function should be used to actually do the work of creating the viewmodel.
-
-
-
-