vector / com.haroldadmin.vector / androidx.fragment.app.Fragment / fragmentViewModel

fragmentViewModel

inline fun <reified VM :VectorViewModel<S>, reified S :VectorState>Fragment.fragmentViewModel(stateStoreContext:CoroutineContext= Dispatchers.Default + Job()):vectorLazy<VM>

Lazy delegate for creating a VectorViewModel from a Fragment

Creates and returns the requested VectorViewModel automatically using reflection. The returned ViewModel is scoped to this Fragment.

Parameters

VM - The type of the VectorViewModel being requested

S - The type of State class bound to the requested ViewModel

stateStoreContext - The CoroutineContext to be used in the ViewModel's state storeinline fun <reified VM :VectorViewModel<S>, reified S :VectorState>Fragment.fragmentViewModel(noinline viewModelCreator: (initialState:S, handle:SavedStateHandle) ->VM):vectorLazy<VM>

Lazy delegate for creating a VectorViewModel from a Fragment using the given producer lambda

Creates and returns the requested VectorViewModel automatically using reflection. The returned ViewModel is scoped to this Fragment.

Parameters

VM - The type of the VectorViewModel being requested

S - The type of State class bound to the requested ViewModel

viewModelCreator - The lambda which creates and returns the requested ViewModel