Sketch
public protocol Sketch
An object which can draw shapes to a DrawingContext
-
Title of the sketch
Declaration
Swift
static var title: String { get set } -
Size of the sketch
Declaration
Swift
var size: Size { get set } -
Whether to repeatedly call
.draw()Declaration
Swift
var loop: SketchAnimation { get set } -
Instantiate a new sketch
Declaration
Swift
init() -
Draw all objects to the current
DrawingContextDeclaration
Swift
func draw() -
contextExtension methodReturns the current
DrawingContextDeclaration
Swift
public var context: DrawingContext? { get } -
hashedFileName()Extension methodReturn a unique file name based on a hash of the time and pid.
The string takes the form of
YYYYMMDD-HHmmss-<short hash>Declaration
Swift
public func hashedFileName() -> String -
drawBackground(fillColor:Extension methoddrawInSVG: ) Draw a solid rectangle over the sketch
Declaration
Swift
public func drawBackground(fillColor: Color = .white, drawInSVG: Bool = false)Parameters
fillColorColor of the background to draw
drawInSVGDraw the background in
SVGContext
View on GitHub
Sketch Protocol Reference