[SOLVED] Styling of NSTextField


How to make border and style of NStextField like that (except icon on the right)? Is it custom or built-in?

enter image description here


Set new CALayer and play with isBezeled and isBordered properties before setting colors.

let field = NSTextField()
field.layer = CALayer()
field.wantsLayer = true
field.isBezeled = false
field.isEditable = true
field.isBordered = true
field.backgroundColor = NSColor.white
field.layer?.borderColor = NSColor.gray.cgColor
field.layer?.backgroundColor = NSColor.white.cgColor
field.layer?.borderWidth = 1
field.layer?.cornerRadius = 5

Answered By – Vladislav

Answer Checked By – Willingham (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *