Skip to content
Khoa Pham@onmyway133

How to make label from NSTextField in macOS

1 min read

From macOS 10.12 https://developer.apple.com/documentation/appkit/nstextfield

init(labelWithAttributedString: NSAttributedString)
init(labelWithString: String)
init(string: String)
init(wrappingLabelWithString: String)
let label = NSTextField(labelWithString: "Almighty. Happy cleaning.")
label.textColor = NSColor.white
label.font = NSFont.systemFont(ofSize: 20, weight: .medium)
label.alignment = .center

Type to search titles and full text.

↑ ↓ move↵ openPagefind