Created
April 10, 2016 07:34
-
-
Save towry/c83fef4d1000a1a10211b34723b6c901 to your computer and use it in GitHub Desktop.
custom nsview class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put this in playground | |
class MyView : NSView { | |
override func drawRect(dirtyRect: NSRect) { | |
let pathRect = NSInsetRect(self.bounds, 1, 1) | |
let path = NSBezierPath(roundedRect: pathRect, xRadius: 10, yRadius: 10) | |
path.lineWidth = 4 | |
NSColor.greenColor().setFill() | |
NSColor.blackColor().setStroke() | |
path.fill() | |
path.stroke() | |
} | |
} | |
let viewRect = NSRect(x: 0, y: 0, width: 100, height: 100) | |
let myEmptyView = MyView(frame: viewRect) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment