For a NSScrollView
in Swift AppKit for MacOS, I want to be able to scroll through the list while dragging an object (e.g. file). It works using a mouse using the scroll wheel. With touch pad, it won't. My assumption is that if I move to the top of the list, scrolling upwards starts. This works using a ScrollView
in SwiftUI out-of-the-box.
Current code (main part):
let scrollView = NSScrollView(frame: frame)
scrollView.hasVerticalScroller = false
scrollView.autohidesScrollers = true
scrollView.backgroundColor = .white
scrollView.scrollerStyle = .overlay
let contentView = ContextMenuView(directoryURL: directoryURL, windowWidth: windowWidth)
scrollView.documentView = contentView
self.contentView = scrollView
Searching Google, I found some info about NSClipView
but couldn't make this work at all. And I'm actually not sure whether this will help.
Actual Question:
How can I enable (auto)scrolling when dragging a file to the top/bottom of a NSScrollView
in AppKit on MacOS?