Drawing

public class Drawing : Codable

Stores list of shapes and size of drawing.

  • Declaration

    Swift

    public var size: CGSize
  • Declaration

    Swift

    public private(set) var shapes: [Shape]
  • You must set this property if you use any shapes other than the built-in ones and you also want to use the Codable features of Drawsana. It’s simple:

    drawingView.drawing.shapeDecoder = {
      $0.tryDecoding(MyShape.self)  // repeat for each custom shape class
    }
    

    This is needed because there is no way to use Decodable with a dynamic list of types.

    Declaration

    Swift

    public var shapeDecoder: ((MultiDecoder<Shape>) -> Void)?
  • Declaration

    Swift

    public init(size: CGSize)