Created
January 29, 2019 00:46
-
-
Save Tulakshana/376296838e80ac1c06d1c3e905e7bcef to your computer and use it in GitHub Desktop.
NSView's missing setter for background colour
This file contains 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
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