DrawingOperation

public protocol DrawingOperation

All drawing operations must implement this protocol

  • shouldAdd(to:) Default implementation

    Return true iff this operation should be added to the undo stack. Default implementation returns true.

    This method may be used to coalesce operations together. For example, the operation to change a text shape’s text may coalesce itself with the operation to add the text shape to the drawing.

    Default Implementation

    Declaration

    Swift

    func shouldAdd(to operationStack: DrawingOperationStack) -> Bool
  • Declaration

    Swift

    func apply(drawing: Drawing)
  • Declaration

    Swift

    func revert(drawing: Drawing)