An approach that doesn't require listening to mouse drags or any active updating of the view is to use auto layout:
1. Override dividerThickness
to return your ideal thickness.
2. Override dividerColor
to return clear if your custom view is not opaque and if you don't want the default grey showing through.
If you have a minimum deployment target of 10.11 or later:
3a. Set arrangesAllSubviews
to NO on the split view and then add the custom divider view as a subview of the split view. (without setting arrangesAllSubviews
to NO, adding the custom divider view would add it as a split pane)
Otherwise, if your minimum deployment target is < 10.11 (or you otherwise cannot set arrangesAllSubviews
to NO):
3b. Add a your custom divider as a subview of the container of the split view, but making sure it's higher in subview/z-order
4. Add constraints to position that view where the divider would be, e.g.:
let constraints = [dividerView.topAnchor.constraint(equalTo: topPane.bottomAnchor),
dividerView.bottomAnchor.constraint(equalTo: topPane.bottomAnchor),
dividerView.leadingAnchor.constraint(equalTo: splitView.leadingAnchor),
dividerView.trailingAnchor.constraint(equalTo: splitView.trailingAnchor)]
NSLayoutConstraint.activate(constraints)
Auto layout will take care of updating the position of the divider view when the user drags.