Skip to content

Instantly share code, notes, and snippets.

@zenangst
Created February 21, 2018 06:19
Show Gist options
  • Save zenangst/52c852df884fc61726e0d561a8016e6c to your computer and use it in GitHub Desktop.
Save zenangst/52c852df884fc61726e0d561a8016e6c to your computer and use it in GitHub Desktop.
How to make a label in macOS - Example 2
import Cocoa
let label = NSTextField()
label.frame = CGRect(origin: .zero, size: CGSize(width: 100, height: 44))
label.stringValue = "My awesome label"
label.backgroundColor = .white
label.isBezeled = false
label.isEditable = false
label.sizeToFit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment