I want to implement drag&drop of an entry in an NSTableView to a folder in Finder.
Here is my code of the controller:
The method filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, fileNameForType fileType: String) is called.
But filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL, completionHandler: @escaping (Error?) -> Void) is never called.
I am using Xcode 12.2 beta 3 (12B5035g).
Do you have similar problems with drag&drop?
Thanks,
Dirk
Here is my code of the controller:
Code Block override func viewDidLoad() { super.viewDidLoad() self.tableView.setDraggingSourceOperationMask(.copy, forLocal: false) } func tableView(_ tableView: NSTableView, pasteboardWriterForRow row: Int) -> NSPasteboardWriting? { return NSFilePromiseProvider(fileType: kUTTypeJPEG as String, delegate: self) } func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, fileNameForType fileType: String) -> String { return "test.jpg" } func filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL, completionHandler: @escaping (Error?) -> Void) { print("never called") }
The method filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, fileNameForType fileType: String) is called.
But filePromiseProvider(_ filePromiseProvider: NSFilePromiseProvider, writePromiseTo url: URL, completionHandler: @escaping (Error?) -> Void) is never called.
I am using Xcode 12.2 beta 3 (12B5035g).
Do you have similar problems with drag&drop?
Thanks,
Dirk