Badge View

xib-based

Drag NSView control to xib interface from control libraries, change control custom class to component class name of your exported.


code-based

Declare lazy load variable in the controller class and add it to the view.

import Cocoa
class ViewController: NSViewController {
    lazy var badgeField: HDBadgeField = {
        let badgeField = HDBadgeField(frame: NSRect(x: 100, y: 100, width: 24, height: 24))
        return badgeField
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.addSubview(badgeField)
    }

}