remember View Model Instance
fun rememberViewModelInstance(file: RiveFile, source: ViewModelInstanceSource? = null): ViewModelInstance
Creates a ViewModelInstance from the given file and source.
The lifetime of the instance is managed by this composable. It will delete the instance when it falls out of scope.
Return
The created ViewModelInstance.
Parameters
file
The RiveFile to create the view model instance from.
source
The source of the view model instance. Constructed from ViewModelSource combined with ViewModelInstanceSource. If none is provided, the default artboard for the file will be created, and the default view model and view model instance will be used.
If you already have an artboard, prefer to use ViewModelSource.DefaultForArtboard, since that will avoid instantiating another artboard.
This is the equivalent of "auto-binding" in other SDKs.