Skip to content

Instantly share code, notes, and snippets.

@codePrincess
Created August 7, 2017 11:32
Show Gist options
  • Save codePrincess/2a1f083402e59b8cae2d29aa44b0a3b4 to your computer and use it in GitHub Desktop.
Save codePrincess/2a1f083402e59b8cae2d29aa44b0a3b4 to your computer and use it in GitHub Desktop.
playground structure for basic doodeling
//at the very top of the class
import Foundation
import UIKit
import PlaygroundSupport
public class MyDoodleCanvas {
...
}
//after the class implementation
var canvasView = UIView(frame: CGRect(x: 0, y: 0, width: 450, height: 630))
var myCanvas = MyDoodleCanvas()
myCanvas.backgroundColor = .white
myCanvas.isUserInteractionEnabled = true
myCanvas.frame = canvasView.frame
canvasView.addSubview(myCanvas)
//most important: tell the playground what to display!
PlaygroundPage.current.liveView = canvasView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment