Drawing

public class Drawing : Codable

Stores list of shapes and size of drawing.

  • Set to true to have decoding throw an error if a shape can’t be decoded. Otherwise, shapes with errors are ignored to avoid degrading user experience.

    Declaration

    Swift

    public static var debugSerialization: Bool
  • Declaration

    Swift

    public var size: CGSize
  • Declaration

    Swift

    public private(set) var shapes: [Shape] { get }
  • 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)

Codable

Operations