Author
Travis Kirton


Text Shapes

You can create a shape from a font and a string.

let ts = TextShape(text:"C4", font: f)!

TextShapes are optional, so you’ll need to unwrap them to put them to use.

Fonts

The easiest way to create a font is to pick a name from iOSFonts.com, and specify a size:

let f = Font(name: "Helvetica", size: 120)!

Fonts are optional, so you’ll need to unwrap them to put them to use.

Example

//create a font (120 is big enough for an iPad, make it smaller for iPod/iPhone)
let f = Font(name: "Helvetica", size: 240)!

//create a shape using a string and font
let textShape = TextShape(text:"C4", font: f)!
textShape.center = self.canvas.center

//add the shape to the canvas
canvas.add(textShape)