This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Leonard Burton
Posted Aug 18 - Read on Facebook

After I've imported my artboards from Sketch, is there any way in the code to iterate through all of these layers?

I know you can usually do layername.subLayers but this doesn't seem to work here.

4 Comments

George Kedenburg III

subLayers is old syntax, try layer.children

Leonard Burton

subLayers seems to output exactly the same. If I output it to console I can see all the layers in there but it's not an iteratable array so I can't do what I'd like with it.

Leonard Burton

I've had some problems with what I was trying to do but worked around them. The answer to this problem seemed to be using:

for key of sketch
# Iterate through here as needed.

Jonas Treub

Independent from Sketch imports you can iterate over all layers that exist in the current context like so:
print layer for layer in Framer.CurrentContext.layers

Read the entire post on Facebook