RiveDataBindingViewModelInstanceProperty
An object that represents a property of a view model instance. This is the base class for all property types.
Properties
name
@property(nonatomic, readonly) NSString* name;
The name of the property.
hasChanged
@property(nonatomic, readonly) BOOL hasChanged;
Returns whether the property has changed, and the change will be reflected on next advance.
Methods
clearChanges
Resets a property’s changed status, resetting hasChanged to false.
removeListener:
- (void)removeListener:(NSUUID*)listener;
Removes a listener for the property.
Parameters:
listener - The listener to remove. This value will be returned by the matching call to addListener.
RiveDataBindingViewModelInstanceStringProperty
An object that represents a string property of a view model instance.
Properties
value
@property(nonatomic, copy) NSString* value;
The string value of the property.
Methods
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceStringPropertyListener)listener;
Adds a block as a listener, called with the latest value when value is updated.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The value can be updated either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceStringPropertyListener)(NSString*);
RiveDataBindingViewModelInstanceNumberProperty
An object that represents a number property of a view model instance.
Properties
value
@property(nonatomic, assign) float value;
The number value of the property.
Methods
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceNumberPropertyListener)listener;
Adds a block as a listener, called with the latest value when value is updated.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The value can be updated either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceNumberPropertyListener)(float);
RiveDataBindingViewModelInstanceBooleanProperty
An object that represents a boolean property of a view model instance.
Properties
value
@property(nonatomic, assign) BOOL value;
The boolean value of the property.
Methods
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceBooleanPropertyListener)listener;
Adds a block as a listener, called with the latest value when value is updated.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The value can be updated either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceBooleanPropertyListener)(BOOL);
RiveDataBindingViewModelInstanceColorProperty
An object that represents a color property of a view model instance.
Properties
value
@property(nonatomic, copy) RiveDataBindingViewModelInstanceColor* value;
The color value of the property as an integer, as 0xAARRGGBB.
RiveDataBindingViewModelInstanceColor is a type alias for NSColor on macOS and UIColor on iOS.
Methods
set(red:green:blue:)
- (void)setRed:(CGFloat)red
green:(CGFloat)green
blue:(CGFloat)blue;
Sets a new color value based on RGB values, preserving its alpha value.
Parameters:
red - The red value of the color (0-255).
green - The green value of the color (0-255).
blue - The blue value of the color (0-255).
set(red:green:blue:alpha:)
- (void)setRed:(CGFloat)red
green:(CGFloat)green
blue:(CGFloat)blue
alpha:(CGFloat)alpha;
Sets a new color value based on alpha and RGB values.
Parameters:
red - The red value of the color (0-255).
green - The green value of the color (0-255).
blue - The blue value of the color (0-255).
alpha - The alpha value of the color (0-255).
setAlpha:
- (void)setAlpha:(CGFloat)alpha;
Sets a new alpha value, preserving the current color.
Parameters:
alpha - The alpha value of the color (0-255).
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceColorPropertyListener)listener;
Adds a block as a listener, called with the latest value when value is updated.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The value can be updated either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceColorPropertyListener)(RiveDataBindingViewModelInstanceColor*);
RiveDataBindingViewModelInstanceEnumProperty
An object that represents an enum property of a view model instance.
Properties
value
@property(nonatomic, copy) NSString* value;
The current string value of the enum property.
values
@property(nonatomic, readonly) NSArray<NSString*>* values;
An array of all possible values for the enum.
valueIndex
@property(nonatomic, assign) int valueIndex;
The index of the current value in values. Setting a new index will also update the value of this property.
If the new index is outside of the bounds of values, this will do nothing, or return 0.
Methods
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceEnumPropertyListener)listener;
Adds a block as a listener, called with the latest value when value is updated.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The value can be updated either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceEnumPropertyListener)(NSString*);
RiveDataBindingViewModelInstanceTriggerProperty
An object that represents a trigger property of a view model instance.
Methods
trigger
Triggers a trigger property.
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceTriggerPropertyListener)listener;
Adds a block as a listener, called when the property is triggered.
Parameters:
listener - The block that will be called when the property is triggered.
Returns: A UUID for the listener, used in conjunction with removeListener.
The property can be triggered either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceTriggerPropertyListener)(void);
RiveDataBindingViewModelInstanceImageProperty
An object that represents an image property of a view model instance.
Methods
setValue:
- (void)setValue:(nullable RiveRenderImage*)image;
Sets a new image value for the property.
Parameters:
image - The render image to set, or nil to clear.
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceImagePropertyListener)listener;
Adds a block as a listener, called when the property is triggered.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The property can be triggered either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceImagePropertyListener)(void);
RiveDataBindingViewModelInstanceListProperty
An object that represents a list property of a view model instance.
Properties
count
@property(nonatomic, readonly) NSUInteger count;
The number of instances in the list.
Methods
instance(at:)
- (nullable RiveDataBindingViewModelInstance*)instanceAtIndex:(int)index;
Gets an instance at the specified index.
Parameters:
index - The index of the instance to get.
Returns: The instance at the specified index, or nil if the index is out of range.
append(_:)
- (void)addInstance:(RiveDataBindingViewModelInstance*)instance;
Adds an instance to the list.
Parameters:
instance - The instance to add.
insert(_:at:)
- (BOOL)insertInstance:(RiveDataBindingViewModelInstance*)instance atIndex:(int)index;
Inserts an instance to the list at a given index.
Parameters:
instance - The instance to add to the list.
index - The index in the list at which to insert an instance. This value must not be greater than the count of elements in the array.
Returns: true if the instance has been added, otherwise false.
remove(_:)
- (void)removeInstance:(RiveDataBindingViewModelInstance*)instance;
Removes an instance from the list.
Parameters:
instance - The instance to remove.
remove(at:)
- (void)removeInstanceAtIndex:(int)index;
Removes an instance at the specified index.
Parameters:
index - The index of the instance to remove.
swap(at:with:)
- (void)swapInstanceAtIndex:(uint32_t)firstIndex withInstanceAtIndex:(uint32_t)secondIndex;
Swaps two instances in the list.
Parameters:
firstIndex - The index of the first instance.
secondIndex - The index of the second instance.
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceListPropertyListener)listener;
Adds a block as a listener, called when there is a change to the list.
Parameters:
listener - The block that will be called when there is a change to the list.
Returns: A UUID for the listener, used in conjunction with removeListener.
The property can be triggered either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceListPropertyListener)(void);
RiveDataBindingViewModelInstanceArtboardProperty
An object that represents an artboard property of a view model instance.
Methods
setValue:
- (void)setValue:(nullable RiveBindableArtboard*)artboard;
Sets a bindable artboard as the new value of the property. Setting this value to nil will unbind the previously bound artboard.
Parameters:
artboard - The artboard to bind to this property, or nil to unbind.
This will trigger any listeners added to this property.
setViewModelInstance:
- (void)setViewModelInstance:(nullable RiveDataBindingViewModelInstance*)instance;
Sets the view model instance to bind to the value of this artboard property.
Parameters:
instance - The view model instance to set for this property.
addListener:
- (NSUUID*)addListener:(RiveDataBindingViewModelInstanceArtboardPropertyListener)listener;
Adds a block as a listener, called when the property is triggered.
Parameters:
listener - The block that will be called when the property’s value changes.
Returns: A UUID for the listener, used in conjunction with removeListener.
The property can be triggered either explicitly by the developer, or as a result of a change in a state machine.
Listener Type:
typedef void (^RiveDataBindingViewModelInstanceArtboardPropertyListener)(void);