Shape

public class Shape : Layer

Represents a Shape layer in Sketch

  • Background color of the Shape

    Declaration

    Swift

    public let backgroundColor: Color
  • Thickness of the border

    Declaration

    Swift

    public let borderWidth: CGFloat
  • Color of the border

    Declaration

    Swift

    public let borderColor: Color
  • Optional gradient. If this is set then backgroundColor is ignored

    Declaration

    Swift

    public let gradient: Gradient?
  • If this is true then this Shape will act as a mask for all layers below it

    Declaration

    Swift

    public let isMask: Bool
  • Creates a generic Shape layer in Sketch

    Declaration

    Swift

    public convenience init(name: String, backgroundColor: Color, bezierPath: BezierPath, borderWidth: CGFloat, borderColor: Color, isMask: Bool, gradient: Gradient?)

    Parameters

    name

    Name of the Shape as it appears in Sketch

    backgroundColor

    Background color of the Shape

    bezierPath

    BezierPath representing the structure and posititon of the Shape

    borderWidth

    Thickness of the border

    borderColor

    Color of the border

    isMask

    Wether this Shape will act as a mask for all layers below it

    gradient

    Optional. If this is not nil set then backgroundColor is ignored

  • Creates a rectangular Shape layer in Sketch. Use this to be able to surface corner radius sliders in sketch

    Declaration

    Swift

    public convenience init(name: String, backgroundColor: Color, rectanglePath: RectanglePath, borderWidth: CGFloat, borderColor: Color, isMask: Bool, gradient: Gradient?)

    Parameters

    name

    Name of the Shape as it appears in Sketch

    backgroundColor

    Background color of the Shape

    rectanglePath

    RectanglePath representing the structure and position of the Shape

    borderWidth

    Thickness of the border

    borderColor

    Color of the border

    isMask

    this is true then this Shape will act as a mask for all layers below it

    gradient

    Optional. If this is not nil set then backgroundColor is ignored

  • Declaration

    Swift

    public required init?(json: [String : Any])