Dear colleagues, I ask you to help me with my problem. I have a task to execute flatten group layer to bitmap, i do not mind doing this through the Sketch JS API or through native code, but I don’t understand how to do it!
Below I will give an example of the code that I managed to find, then I could not find anything on this issue.
My group that I need to rasterize is in the
eachElement.parrent variable, where
eachElement is the sketch object itself and
.parent this calls its parent, and so
eachElement.parent is the group that needs to be turned into a picture (layer). Please help me with the code, thank you in advance.
let flattened = eachElement.flattenedLayer();
let flattener = MSLayerFlattener.alloc().init();
When this code is running, an error occurs (there is no normal debugging in Sketch) The console does not give a problem, the plugin just stops at this stage.
p.s: The code that should rasterize the group will be executed in array loop.