Overview
An object that represents a View Model of a Rive file. Use this class to access view model instances and their properties for data binding at runtime.Properties
name
instanceCount
instanceNames
propertyCount
properties
Methods
createInstanceFromIndex:
index- The index of an instance within the view model. The index starts at 0, where 0 is the first instance that appears in the “Data Bind” panel’s instances dropdown.
RiveDataBindingViewModelInstance if the index is valid, otherwise nil.
A strong reference to this instance must be maintained if it is being bound to a state machine or artboard, or for observability. Fetching a new instance from the same model, if not bound, will not update its properties when properties are updated.
createInstanceFromName:
name- The name of an instance within the view model. The name must match the name of an instance in the “Data Bind” panel’s instances dropdown, where the instance has been exported.
RiveDataBindingViewModelInstance if an instance with the given name exists, otherwise nil.
A strong reference to this instance must be maintained if it is being bound to a state machine or artboard, or for observability. Fetching a new instance from the same model, if not bound, will not update its properties when properties are updated.
createDefaultInstance
RiveDataBindingViewModelInstance representing the default instance, or nil if no default instance exists.
A strong reference to this instance must be maintained if it is being bound to a state machine or artboard, or for observability. Fetching a new instance from the same model, if not bound, will not update its properties when properties are updated.
createInstance
- String:
"" - Number:
0 - Boolean:
false - Color:
ARGB(0, 0, 0, 0) - Enum: An enum’s first value
RiveDataBindingViewModelInstance with default values, or nil if the instance cannot be created.
A strong reference to this instance must be maintained if it is being bound to a state machine or artboard, or for observability. Fetching a new instance from the same model, if not bound, will not update its properties when properties are updated.