implementing Drag and Drop Functionality in NSTableView on macOS 13.6
I just started working with I need some guidance on I've been struggling with this for a few days now and could really use some help. I'm having trouble implementing drag and drop functionality in an NSTableView on macOS 13.6. I followed the standard approach to enable drag and drop, but it seems that the dragging session is not being recognized properly, leading to unexpected behaviors. When I start dragging a row, the dragging session initiates, but it fails to highlight the row being dragged and also triggers a crash with the behavior: `-[NSApplication _handleEvent:]: unrecognized selector sent to instance`. I've implemented the following code for my NSTableView: ```swift class MyTableViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate { @IBOutlet weak var tableView: NSTableView! override func viewDidLoad() { super.viewDidLoad() tableView.registerForDraggedTypes([.string]) } func tableView(_ tableView: NSTableView, numberOfRowsInSection section: Int) -> Int { return data.count } func tableView(_ tableView: NSTableView, fileWrapperForRowsAtIndexPath indexPath: IndexPath) -> NSPasteboardWriter? { let item = data[indexPath.row] return NSPasteboardItem().apply { $0.setString(item, forType: .string) } } func tableView(_ tableView: NSTableView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation { return .move } func tableView(_ tableView: NSTableView, acceptDrop info: NSDraggingInfo, row index: Int, dropOperation: NSTableView.DropOperation) { // Handle drop } } ``` I've also ensured that the delegate and dataSource are connected properly in Interface Builder. The dragging session seems to start fine, but the crash happens consistently when I attempt to drop the dragged item. I've tried cleaning the build folder and restarting Xcode without any success. Any suggestions on what could be going wrong or how to debug the situation further? My development environment is Ubuntu. The stack includes Swift and several other technologies. Any pointers in the right direction? I'm on Linux using the latest version of Swift. Could someone point me to the right documentation? I've been using Swift for about a year now. Is this even possible?