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

What is Framer? Join the Community
Return to index
Mike Brits
Posted Apr 12 - Read on Facebook

Hey Framers,
I've got an idea I'd like to try out, just looking for the best way to do it. Is there a way to embed custom metadata into a layer in Sketch, and retrieve it in Framer?
In Sketch, I have figured out that I can set userInfo on a layer (standard Javascript object key value pairs) but it doesn't look like that gets kept on a Framer import.
Is there a good way to save custom data in Sketch that can be accessed in Framer? Maybe alongside the opacity in metadata? Google is not as helpful as I thought it would be.
Thanks!

2 Comments

Wei Sun

Mike Brits Thanks for the post which supported my research on saving customized key/value in a layer's userInfo.

http://sketchplugins.com/d/41-saving-data-in-a-document

```
var sketch = context.api()

var document = sketch.selectedDocument;
var selection = document.selectedLayers;

var command = context.command;

var selectedLayer = context.document.selectedLayers().firstLayer()

command.setValue_forKey_onLayer_forPluginIdentifier('chips!',
'testAgain',selectedLayer,'myplugin');

log(command.valueForKey_onLayer_forPluginIdentifier('testAgain',
selectedLayer,'myplugin'));

```

Koen Bok

I know that the Sketch guys are working on a way to expose metadata in the form of key: value on objects. It would be very easy for us to add that to imported layers.

Until then, it's hackery based on layer names :-/ Or you could build a Sketch plugin to set the info yourself.

Read the entire post on Facebook