Skip to content

Instantly share code, notes, and snippets.

@MW3000
Created April 3, 2018 11:18
Show Gist options
  • Save MW3000/ddf4d6c9c928470035438b6139927dc0 to your computer and use it in GitHub Desktop.
Save MW3000/ddf4d6c9c928470035438b6139927dc0 to your computer and use it in GitHub Desktop.
NSView Subclass Template Playground (Swift 4.1, Xcode 9.3)
//: Playground - noun: a place where people can play
// Swift 4.1, Xcode 9.3
import Cocoa
import PlaygroundSupport
class CustomView: NSView {
override func draw(_ dirtyRect: NSRect) {
// Add your drawing code here.
}
}
let customView = CustomView(frame: NSRect(x: 0, y: 0, width: 400, height: 400))
PlaygroundPage.current.liveView = customView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment