New in Sketch 84

Sketch 84 is still in beta. We offer these notes as a preview of the upcoming changes to plugin developers.

Changes

We removed the internal class MSLayerArray from our codebase. Code that dealt with layer arrays now uses regular NSArray objects instead. This change made our internal code cleaner and easier to maintain by removing an unnecessary layer of abstraction.

As mentioned in our Internal API page, this is an internal class that should never be used. But we are aware that some plugins use it, and we’re providing this information to help them migrate their code to use the new APIs.

Code expecting an MSLayerArray object, and using its .layers() method to get an NSArray with the layers, will now receive an NSArray object. The .layers() call is no longer needed.

Plugins relying on any of the internal methods in MSLayerArray will not work. They may even crash Sketch if they’re passing the returned value unchecked to other parts of the plugin code.

Check the table in the next section for examples of how to migrate your code.

We recommend using the JavaScript API where possible. If you feel something is missing from our API, please submit feedback and feature requests!.

Some examples

Note: when making changes to your plugin, you may want to add a version check to ensure that the code keeps working with older versions of Sketch. You can check the value of BCSketchInfo.shared().metadata().appVersion to see what the current version is.

If your plugin uses code similar to this… …use this instead
this._object.selectedLayers().layers() this._object.selectedLayers()
var layerArray = MSLayerArray.arrayWithLayer(layer) var layerArray = [layer]
var layerArray = MSLayerArray.arrayWithLayers([layers]) var layerArray = [layers]
var layerArray = MSLayerArray.emptyArray() var layerArray = []
var layerArray = MSLayerArray.initWithLayers([layers]) var layerArray = [layers]
See something wrong or incomplete? Improve this page.