createLazyViewModel

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.

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. It knows how to configure the viewmodel, and just needs to be provided with a state factory.