How would I programmatically swap one instance of a symbol with another symbol? The equivalent of selecting a symbol on the artboard and then from the inspector symbol drop down selecting a new symbol to replace it.
Ashung I'm having a little bit of trouble / confusion. What is the argument MSSymbolMaster expecting? An instance of the symbol, the ID or what?
a symbol instance has a master property. You can assign it to change the master.
symbolInstance.master = newMaster
Alternatively, you can assign the symbolId property
mathieudutour Thank you! Assigning the symbolId ended up being much easier then what I was trying to do.
mathieudutour Hi sir. I find out on the official API document that symbolInstance is usually used to creat a new symbol instance. Is there any way to change an already inserted symbol instance's master property programmatically? thanks
@mathieudutour Does the API have the equivalent of 'Set To Original Size'?
kupe517 There isn't one yet, you will need to fall back to the obj-c API:
symbolInstance.sketchObject.scale = 1;
(Happy to accept a PR to add it to the API 🙂 )
This is just what I need! Do you mind sharing the whole script? Basically everything that happens once you select the symbol you want to swap.