SketchView

open class SketchView : NSView

A basic subclass of NSView for displaying a Sketch

  • Use top-left origin

    Declaration

    Swift

    override open var isFlipped: Bool { get }
  • The file name of the current drawing

    Declaration

    Swift

    public private(set) var fileName: String? { get }
  • The Sketch to display

    Declaration

    Swift

    open var sketch: Sketch? { get set }
  • Calls the sketches .draw() method

    Declaration

    Swift

    override open func draw(_ dirtyRect: NSRect)
  • Draws the sketch to an image

    Declaration

    Swift

    open func drawToImage() -> NSImage?
  • Creates an SVG document

    Declaration

    Swift

    open func drawToSVG() -> XMLDocument?
  • Save an image to the specified URL

    Declaration

    Swift

    open func saveImage(_ image: NSImage, to url: URL) throws

    Parameters

    image

    Image to save

    url

    URL to save to

  • Draw the sketch to an image and attempt to save it

    Declaration

    Swift

    open func saveImage(to url: URL) throws

    Parameters

    url

    URL to write the image to

  • Generates an SVG and attempts to write it to the specified URL

    Declaration

    Swift

    open func saveSVG(to url: URL) throws

    Parameters

    url

    URL to write to

  • Passes clicks to the sketch

    Declaration

    Swift

    @IBAction
    open func clickGestureAction(_ sender: NSClickGestureRecognizer)
  • Passes pan gestures to the sketch

    Declaration

    Swift

    @IBAction
    open func panGestureAction(_ sender: NSPanGestureRecognizer)
  • Passes scroll events to the sketch

    Declaration

    Swift

    override open func scrollWheel(with event: NSEvent)