Im am trying to get the NsUrl / NSData for an NSPromise image dragged from Safari.
The Apple documentation for drag and drop seems quite unclear. It says I should assume there is a property called Droplocation but doesn't say: - what it is - where it comes from - and how to obtain it.
NSView doesn't have a drop Location property- so it would be useful to know where we get it from before we are asked to assume it exists.
Can anyone help me fathom where I can get the dropLocation in the snippet below from my NSView?
Link to the documentation: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DragandDrop/Tasks/DraggingFiles.html
NSURL *dropLocation; // Assume this exists
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSFilesPromisePboardType] ) {
NSArray *filenames = [sender
namesOfPromisedFilesDroppedAtDestination:dropLocation];
// Perform operation using the files’ names, but without the
// files actually existing yet
}
return YES;
}
Any help with getting a working version of the code above?