Default View Model Delegate Factory
Creates ViewModels that are wrapped with a lifecycleAwareLazy so that the ViewModel is automatically created when the Fragment is started (if it is not accessed before then).
ViewModels are created with a RealMavericksStateFactory.
The Fragment is subscribed to all changes to the ViewModel, so that MavericksView.postInvalidate is called on each State change. This allows the Fragment view to be automatically invalidated, only while the Fragment is in the STARTED lifecycle state.
Constructors
DefaultViewModelDelegateFactory
Link copied to clipboard
fun DefaultViewModelDelegateFactory()
Content copied to clipboard
Functions
create Lazy View Model
Link copied to clipboard
open override 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>
Content copied to clipboard
Create a Lazy ViewModel for the given Fragment.