Skip to main content
100%

Get layer from ID

✓ Published0🌍 Public
KKevinGutowski
Last edited Jun 10, 2020
Created on Jun 10, 2020

This example demonstrates how to retrieve a specific layer from a Sketch document by its ID using the `document.getLayerWithID(layerID)` method. It also shows an alternative approach with the Sketch API’s `sketch.find(`#${layerID}`)[0]` function, which queries the document tree for elements matching a CSS-style selector. The code highlights two concise techniques for locating layers programmatically, enabling direct access to layer objects for further manipulation or inspection. The gist focuses on the retrieval pattern itself, without additional rendering or data processing.

AI-generated description

Similar vizzes