Gone from Sketch 51 is MSBitmapLayer.bitmapLayerWithImageFromPath_. Does anybody know what replaces it?
I think that method has been reconfigured and move to MSStyledLayer as layerWithImageFromFileURL:. Rather than just a string of the image path, seems you should first create a NSURL.
James Thanks for the tip, but unless I’m doing something wrong (which is totally possible) this doesn’t seem like a 1:1 replacement for [MSBitmapLayer bitmapLayerWithImageFromPath]. All I can get [MSStyledLayer layerWithImageFromFileURL] to return is a null object and certainly not a layer object.
var pathToFile = "";
// if sketchVersion >= 51
var image = NSImage.alloc().initWithContentsOfFile(pathToFile);
var imageData = MSImageData.alloc().initWithImage(image);
var bitmapLayer = MSBitmapLayer.alloc().initWithFrame_image(NSZeroRect, imageData);
abynim yes indeed that’s it. Thanks!