So, in Sketch, you can mark a layer/group as exportable.
And then the layer/group can be exported as .png/.svg/.pdf etc. I was trying to make a Sketch Plugin recently, where I need to mark a layer/group as exportable from code. A layer in code is represented using MSLayer
and group is MSLayerGroup
. The sketch documentation is not mature enough yet, so I used ClassDump to extract all the headers that has been used in the app. I have been looking for a method that might seem to do my job, but it has been days and am still out of luck. Can anybody please help me out in this regard?
Sketch supports slice and export to image. You can use
- (void)saveArtboardOrSlice:(id)arg1 toFile:(id)arg2;
method ofMSDocument
.This is almost how to do it.
Reference from @GeertWill's sketch-to-xcode-assets-catalog plugin.