Skip to content

Instantly share code, notes, and snippets.

@Tulakshana
Created January 29, 2019 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tulakshana/376296838e80ac1c06d1c3e905e7bcef to your computer and use it in GitHub Desktop.
Save Tulakshana/376296838e80ac1c06d1c3e905e7bcef to your computer and use it in GitHub Desktop.
NSView's missing setter for background colour
extension NSView {
func setBackgroundColor(color: NSColor) {
let layer = CALayer.init()
layer.backgroundColor = color.cgColor
self.layer = layer
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment