How do i change instance property with the setProperty function?

I’m trying to set the instance property by calling
setProperty({Icon#46:0 : 'key of desired instance'})
but i get
Property value is incompatible with component property type

Is there anything different with setProperty when you swap instances (instead of a boolean or variants)?

Most likely you mean setProperties(obj).

Are you sure the “Icon#46:0” property is of type “INSTANCE_SWAP”?

Yes yes.

Turns out you need to pass id instead of key here. Took me a minute