I'm now trying to add Drag & Drop feature to my NSTableView which uses NSTableViewDiffableDataSource for its data source. However, I can't implement the methods for Drag & Drop like tableView(:, acceptDrop:, row:, dropOperation:).
My code looks like this:
swift
class MyViewController: NSViewController {
private let tableView: NSTableView = {...}()
private lazy var dataSource = MyDataSource(tableView: tableView)
...
}
class MyDataSource: NSTableViewDiffableDataSourceSection, Model {
...
override func tableView(_ tableView: NSTableView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forRowIndexes rowIndexes: IndexSet) {
...
}
}
Since NSTableViewDiffableDataSource implements NSTableViewDataSource protocol which provides Drag & Drop methods, I thought the above overriding method would work but I got this error.
Method does not override any method from its superclass
What happened? And if this is expected, how can I implement Drag & Drop with NSTableViewDiffableDataSource?
3
1
2.3k