Skip to content

Instantly share code, notes, and snippets.

@zenangst
Created February 16, 2018 07:17
Show Gist options
  • Save zenangst/dd7c32cfcd808e906516dcd55340f174 to your computer and use it in GitHub Desktop.
Save zenangst/dd7c32cfcd808e906516dcd55340f174 to your computer and use it in GitHub Desktop.
Setting a background color to an NSView - macOS Example
import Cocoa
let frame = CGRect(origin: .zero, size: CGSize(width: 100, height: 100))
let view = NSView(frame: frame)
view.wantsLayer = true
view.layer?.backgroundColor = NSColor.blue.cgColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment