vector / com.haroldadmin.vector / VectorViewModelFactory
VectorViewModelFactory¶
interface VectorViewModelFactory<VM :VectorViewModel<S>, S :VectorState>
A Factory meant to be implemented using the Companion object of a VectorViewModel to provide ways to create the initial state, as well as the creation of the ViewModel itself.
Parameters¶
VM - The type of the VectorViewModel being created by this factory
S - The state class bound to the given VectorViewModel type
Functions¶
| Name | Summary |
|---|---|
| create | open fun create(initialState:S, owner:ViewModelOwner, handle:SavedStateHandle):VM?Used to create the requested ViewModel. This method needs to be implemented if your ViewModel has dependencies other than those of a VectorViewModel or a SavedStateVectorViewModel. However, if you are using a different kind of factory to create your ViewModel, you might skip implementing this method. |
| initialState | open fun initialState(handle:SavedStateHandle, owner:ViewModelOwner):S?Used to create the initial state, if this method is implemented. |