vector / com.haroldadmin.vector / androidx.activity.ComponentActivity / viewModel
viewModel¶
inline fun <reified VM :
VectorViewModel
<
S
>, reified S :
VectorState
>
ComponentActivity
.viewModel(stateStoreContext:
CoroutineContext
= Dispatchers.Default + Job()):
vectorLazy
<
VM
>
Lazy delegate for creating a VectorViewModel from an Activity
Creates and returns the requested VectorViewModel automatically using reflection. The returned ViewModel is scoped to this activity
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
>
ComponentActivity
.viewModel(noinline viewModelCreator: (initialState:
S
, handle:
SavedStateHandle
) ->
VM
):
vectorLazy
<
VM
>
Lazy delegate for creating a VectorViewModel from an Activity using the given producer lambda
Creates and returns the requested VectorViewModel automatically using reflection. The returned ViewModel is scoped to this activity.
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