NSView Layer Setup
Always set wantsLayer before configuring layer properties
CLAUDE.md
In AppKit, always set wantsLayer = true before configuring any layer properties. Without it, layer properties are silently ignored.
// Good
let view = NSView()
view.wantsLayer = true
view.layer?.backgroundColor = NSColor.black.cgColor
view.layer?.cornerRadius = 8
view.layer?.masksToBounds = true
// Bad — cornerRadius silently ignored
let view = NSView()
view.layer?.cornerRadius = 8 // no effect
For NSTextField with cornerRadius, also set layer?.masksToBounds = true or the background won’t clip to the rounded corners.
Copy this block into your CLAUDE.md or agent config file to enforce it in your workflow.