Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request : NSView extension #533

Closed
phiren opened this issue Aug 4, 2018 · 4 comments · Fixed by #702
Closed

Feature Request : NSView extension #533

phiren opened this issue Aug 4, 2018 · 4 comments · Fixed by #702

Comments

@phiren
Copy link

phiren commented Aug 4, 2018

Can you please add below:

@IBDesignable
extension NSView
{
	@IBInspectable var backgroundColor: NSColor? {
		get {
			if let colorRef = self.layer?.backgroundColor {
				return NSColor(CGColor: colorRef)
			} else {
				return nil
			}
		}
		set {
			self.wantsLayer = true
			self.layer?.backgroundColor = newValue?.CGColor
		}
	}
}
@guykogus
Copy link
Contributor

guykogus commented Aug 4, 2018

You’re welcome to open a pull request yourself and do it 🙂

@phiren
Copy link
Author

phiren commented Aug 4, 2018

Created first pull request, hope someone will approve and merge to master.

@halossd
Copy link

halossd commented Jan 15, 2021

When I use NSTextField.backgroundColor, this is ambiguous property now

@342261733
Copy link

When I use NSTextField.backgroundColor, this is ambiguous property now. same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants