Scroll View

xib-based

Drag NSScrollView 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 scrollView: HDScrollView = {
        let scrollView = HDScrollView(frame: NSRect(x: 100, y: 100, width: 116, height: 116))
        return scrollView
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(scrollView)
    }

}