ViewModelDelegateFactory

interface ViewModelDelegateFactory

This is invoked each time a Fragment accesses a ViewModel via the MvRx 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.

Functions

createLazyViewModel
Link copied to clipboard
abstract fun <S : MavericksState, T : Fragment, MavericksView, VM : MavericksViewModel<S>> createLazyViewModel(fragment: T, viewModelProperty: KProperty<*>, viewModelClass: KClass<VM>, keyFactory: () -> String, stateClass: KClass<S>, existingViewModel: Boolean, viewModelProvider: (stateFactory: MavericksStateFactory<VM, S>) -> VM): Lazy<VM>

Create a Lazy ViewModel for the given Fragment.

Inheritors

DefaultViewModelDelegateFactory
Link copied to clipboard