Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KingOfBrian/adcecf3e24286975b687ef8997581fcd to your computer and use it in GitHub Desktop.
Save KingOfBrian/adcecf3e24286975b687ef8997581fcd to your computer and use it in GitHub Desktop.
Sketch Model Objects
// Ignore the first few unknowns:
struct MSAssetCollection {
let gradients: [<<Unknown>>]
let images: [<<Unknown>>]
let colors: [MSColor]
let imageCollection: MSImageCollection
}
struct MSImageCollection {
let images: [<<Unknown>>]
}
struct MSSymbolContainer {
let objects: [<<Unknown>>]
}
struct MSDocumentData {
let foreignSymbols: [<<Unknown>>]
let layerStyles: MSSharedStyleContainer
let objectID: String
let currentPageIndex: Int
let enableLayerInteraction: Int
let layerSymbols: MSSymbolContainer
let assets: MSAssetCollection
let enableSliceInteraction: Int
let layerTextStyles: MSSharedTextStyleContainer
let pages: [MSPage]
}
struct MSRect {
let height: Int
let x: Int
let y: Int
let constrainProportions: Int
let width: Int
}
struct MSArtboardGroup {
let resizesContent: Int
let grid: MSSimpleGrid
let isVisible: Int
let includeInCloudUpload: Int
let backgroundColor: MSColor
let nameIsFixed: Int
let resizingConstraint: Int
let style: MSStyle
let layers: [MSShapeLayer]
let rotation: Int
let isFlippedHorizontal: Int
let horizontalRulerData: MSRulerData
let hasBackgroundColor: Int
let includeBackgroundColorInExport: Int
let name: String
let verticalRulerData: MSRulerData
let objectID: String
let frame: MSRect
let layerListExpandedType: Int
let isFlippedVertical: Int
let resizingType: Int
let shouldBreakMaskChain: Int
let exportOptions: MSExportOptions
let hasClickThrough: Int
let isLocked: Int
let userInfo: [String: Any]
let layout: MSLayoutGrid
}
struct MSExportOptions {
let layerOptions: Int
let exportFormats: [MSExportFormat]
let includedLayerIds: [<<Unknown>>]
let shouldTrim: Int
}
struct MSOvalShape {
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let frame: MSRect
let layerListExpandedType: Int
let isFlippedVertical: Int
let resizingType: Int
let rotation: Int
let booleanOperation: Int
let shouldBreakMaskChain: Int
let edited: Int
let path: MSShapePath
let isFlippedHorizontal: Int
let exportOptions: MSExportOptions
let isLocked: Int
}
struct MSLayoutGrid {
let isEnabled: Int
let drawHorizontal: Int
let totalWidth: Int
let rowHeightMultiplication: Int
let guttersOutside: Int
let columnWidth: Int
let gutterWidth: Int
let numberOfColumns: Int
let horizontalOffset: Int
let drawHorizontalLines: Int
let gutterHeight: Int
let drawVertical: Int
}
struct MSCurvePoint {
let hasCurveTo: Int
let curveFrom: CGPoint
let curveTo: CGPoint
let curveMode: Int
let hasCurveFrom: Int
let cornerRadius: Int
let point: CGPoint
}
struct MSSharedStyle {
let name: String
let value: MSStyle
let objectID: String
}
struct MSStyleInnerShadow {
let color: MSColor
let offsetY: Int
let blurRadius: Int
let spread: Int
let offsetX: Int
let contextSettings: MSGraphicsContextSettings
let isEnabled: Int
}
struct MSSimpleGrid {
let gridSize: Int
let isEnabled: Int
let thickGridTimes: Int
}
struct MSStyleFill {
let isEnabled: Int
let gradient: MSGradient
let patternFillType: Int
let fillType: Int
let noiseIndex: Int
let noiseIntensity: Int
let patternTileScale: Int
let contextSettings: MSGraphicsContextSettings
let color: MSColor
}
struct NSColor {
let color: String
}
struct MSRulerData {
let guides: [Int]
let base: Int
}
struct MSSharedStyleContainer {
let objects: [MSSharedStyle]
}
struct MSTextStyle {
let NSStrikethrough: Int
let NSUnderline: Int
let MSAttributedStringTextTransformAttribute: Int
let NSFont: UIFont
let NSParagraphStyle: NSParagraphStyle
let NSColor: NSColor
let NSLigature: Int
let NSKern: Int
}
struct MSGraphicsContextSettings {
let blendMode: Int
let opacity: Int
}
struct MSTextLayer {
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let isFlippedVertical: Int
let frame: MSRect
let resizingType: Int
let layerListExpandedType: Int
let style: MSStyle
let rotation: Int
let dontSynchroniseWithSymbol: Int
let attributedString: NSConcreteAttributedString
let isFlippedHorizontal: Int
let glyphBounds: CGPoint
let shouldBreakMaskChain: Int
let automaticallyDrawOnUnderlyingPath: Int
let originalObjectID: String
let exportOptions: MSExportOptions
let lineSpacingBehaviour: Int
let textBehaviour: Int
let isLocked: Int
let heightIsClipped: Int
let userInfo: [String: Any]
}
struct MSShapePathLayer {
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let frame: MSRect
let layerListExpandedType: Int
let isFlippedVertical: Int
let resizingType: Int
let rotation: Int
let booleanOperation: Int
let shouldBreakMaskChain: Int
let edited: Int
let path: MSShapePath
let isFlippedHorizontal: Int
let exportOptions: MSExportOptions
let isLocked: Int
}
struct MSShapeGroup {
let clippingMaskMode: Int
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let isFlippedVertical: Int
let style: MSStyle
let resizingType: Int
let frame: MSRect
let layerListExpandedType: Int
let rotation: Int
let layers: [MSShapeLayer]
let windingRule: Int
let isFlippedHorizontal: Int
let hasClippingMask: Int
let shouldBreakMaskChain: Int
let originalObjectID: String
let exportOptions: MSExportOptions
let hasClickThrough: Int
let isLocked: Int
let userInfo: [String: Any]
}
struct MSBitmapLayer {
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let isFlippedVertical: Int
let clippingMask: CGPoint
let resizingType: Int
let frame: MSRect
let layerListExpandedType: Int
let style: MSStyle
let rotation: Int
let nineSliceScale: CGSize
let isFlippedHorizontal: Int
let image: MSImageData
let shouldBreakMaskChain: Int
let fillReplacesImage: Int
let nineSliceCenterRect: CGPoint
let exportOptions: MSExportOptions
let isLocked: Int
let userInfo: [String: Any]
}
struct MSRectangleShape {
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let frame: MSRect
let layerListExpandedType: Int
let resizingType: Int
let fixedRadius: Int
let isFlippedVertical: Int
let rotation: Int
let hasConvertedToNewRoundCorners: Int
let edited: Int
let isFlippedHorizontal: Int
let path: MSShapePath
let shouldBreakMaskChain: Int
let booleanOperation: Int
let exportOptions: MSExportOptions
let isLocked: Int
}
struct MSGradient {
let from: CGPoint
let shouldSmoothenOpacity: Int
let stops: [MSGradientStop]
let to: CGPoint
let elipseLength: Int
let gradientType: Int
}
struct MSExportFormat {
let fileFormat: String
let name: String
let namingScheme: Int
let visibleScaleType: Int
let scale: Int
let absoluteSize: Int
}
struct MSSharedTextStyleContainer {
let objects: [MSSharedStyle]
}
struct MSStyleReflection {
let strength: Int
let isEnabled: Int
let distance: Int
}
struct MSSymbolMaster {
let resizingConstraint: Int
let resizesContent: Int
let isVisible: Int
let includeInCloudUpload: Int
let backgroundColor: MSColor
let nameIsFixed: Int
let style: MSStyle
let layers: [MSShapeLayer]
let rotation: Int
let isFlippedHorizontal: Int
let horizontalRulerData: MSRulerData
let hasBackgroundColor: Int
let includeBackgroundColorInExport: Int
let symbolID: String
let name: String
let verticalRulerData: MSRulerData
let objectID: String
let frame: MSRect
let includeBackgroundColorInInstance: Int
let layerListExpandedType: Int
let isFlippedVertical: Int
let resizingType: Int
let shouldBreakMaskChain: Int
let originalObjectID: String
let exportOptions: MSExportOptions
let hasClickThrough: Int
let isLocked: Int
}
struct MSShapeLayer {
}
struct MSStyleBorder {
let position: Int
let color: MSColor
let gradient: MSGradient
let fillType: Int
let thickness: Int
let contextSettings: MSGraphicsContextSettings
let isEnabled: Int
}
struct MSStyle {
let fills: [MSStyleFill]
let shadows: [MSStyleShadow]
let reflection: MSStyleReflection
let textStyle: MSTextStyle
let miterLimit: Int
let startDecorationType: Int
let borderOptions: MSStyleBorderOptions
let innerShadows: [MSStyleInnerShadow]
let contextSettings: MSGraphicsContextSettings
let endDecorationType: Int
let sharedObjectID: String
let borders: [MSStyleBorder]
let colorControls: MSStyleColorControls
let blur: MSStyleBlur
}
struct MSStyleBorderOptions {
let lineCapStyle: Int
let lineJoinStyle: Int
let dashPattern: [Int]
let isEnabled: Int
}
struct MSGradientStop {
let position: Int
let color: MSColor
}
struct MSLayerGroup {
let name: String
let resizingConstraint: Int
let nameIsFixed: Int
let isVisible: Int
let objectID: String
let style: MSStyle
let layerListExpandedType: Int
let resizingType: Int
let layers: [MSShapeLayer]
let frame: MSRect
let isFlippedVertical: Int
let rotation: Int
let shouldBreakMaskChain: Int
let isFlippedHorizontal: Int
let originalObjectID: String
let exportOptions: MSExportOptions
let hasClickThrough: Int
let isLocked: Int
let userInfo: [String: Any]
}
struct MSPage {
let name: String
let verticalRulerData: MSRulerData
let resizingConstraint: Int
let includeInCloudUpload: Int
let objectID: String
let isVisible: Int
let nameIsFixed: Int
let isFlippedVertical: Int
let style: MSStyle
let frame: MSRect
let layerListExpandedType: Int
let rotation: Int
let resizingType: Int
let layers: [MSArtboardGroup]
let shouldBreakMaskChain: Int
let isFlippedHorizontal: Int
let horizontalRulerData: MSRulerData
let exportOptions: MSExportOptions
let hasClickThrough: Int
let isLocked: Int
}
struct MSShapePath {
let pointRadiusBehaviour: Int
let isClosed: Int
let points: [MSCurvePoint]
}
struct MSImageData {
let size: String
let sha1: String
}
struct MSSymbolInstance {
let symbolID: String
let name: String
let masterInfluenceEdgeMinXPadding: Int
let overrides: [String: Any]
let resizingConstraint: Int
let nameIsFixed: Int
let objectID: String
let isVisible: Int
let masterInfluenceEdgeMinYPadding: Int
let verticalSpacing: Int
let frame: MSRect
let layerListExpandedType: Int
let style: MSStyle
let rotation: Int
let isFlippedVertical: Int
let resizingType: Int
let horizontalSpacing: Int
let shouldBreakMaskChain: Int
let isFlippedHorizontal: Int
let exportOptions: MSExportOptions
let masterInfluenceEdgeMaxXPadding: Int
let isLocked: Int
let masterInfluenceEdgeMaxYPadding: Int
let userInfo: [String: Any]
}
struct MSStyleBlur {
let motionAngle: Int
let center: CGPoint
let radius: Int
let type: Int
let isEnabled: Int
}
struct MSStyleColorControls {
let contrast: Int
let saturation: Int
let hue: Int
let brightness: Int
let isEnabled: Int
}
struct MSStyleShadow {
let color: MSColor
let offsetY: Int
let blurRadius: Int
let spread: Int
let offsetX: Int
let contextSettings: MSGraphicsContextSettings
let isEnabled: Int
}
struct MSColor {
let value: String
}
@pauljonescodes
Copy link

How did you get these?

@forthelesterkids1
Copy link

same question - how did you get these?

@KingOfBrian
Copy link
Author

Sorry for the delay here. I got this from a bit of a hacky experiment I was playing with https://github.com/rightpoint/sketchycode -- The generated types are pretty mediocre, but you should be able to update the script to generate less bad code, or run more complex sketch files through it to update the models. If you use it for anything useful, please tell me !

@KingOfBrian
Copy link
Author

Also, FMI -- how did you find this? 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment