Object IDs (
do_objectID in JSON,
objectID() CocoaScript) can show up multiple times for a few reasons:
- If a file is duplicated, the copy will have the same IDs as the original. This is useful if your file is a library, since then swapping out one copy for another will not break any symbol links.
- In some cases, copying and pasting will keep (at least some) IDs the same. This behavior may have changed over time with different versions of Sketch.
- The same ID can appear multiple times in the same file like so: once as the unique ID of an object (e.g. a text layer inside a symbol (
MSSymbol)) and again as a reference to that layer, (e.g. an override on that layer in a symbol instance (
- Maybe other situations I haven’t thought of.
In my experience, you can expect every layer of a document to have unique IDs unless a plugin is doing something weird.
Was there a particular case you found of two different layers in the same document with the same ID?