Swapping component instances
Hey there,
i have been trying to achieve something which i don’t know is possible in my current setup - i’d be grateful for some insights:
I have two ViewModels:
1. Infobox => a VM that contains all information for a modal/infobox, such as text, etc.
2. MainVM => the main VM on the main artboard that holds everything about the application
Here is what i have set up so far:
1. I created several instances of the “Infobox” VM, containing all sorts of different variations
2. I have nested that VM into my “mainVM” (on another artboard) - for now, just once (even though i have a lot of instances)
3. I have bound that nested VMinstance to a component on my main artboard (the visual infobox)
So here is my question:
Is it possible to “swap” that nested instance at runtime? By that i mean the instance i bound to the component - so i can swap what is displayed in the infobox, without having to add all the instances to my mainVM or having to create countless separate artboards.
I have tried the “nested property path” approach and also tried to bind another instance directly, but i can’t seem to get this right.
Is this not possible or am i just missing something?
For the record, i know that there are better ways to handle this (using lists or just handling it outside of Rive in code) - but for a variety of reasons, i would need to get this to work for now, before pulling everything apart.
Thanks in advance!