I've been using dragImage:at:offset:event:pasteboard:source:slideBack:
to show an image representation while dragging in previous projects but now that method is deprecated.
I've read that the supposed alternative is using beginDraggingSessionWithItems(…)
but, the thing is I can't manage to do it properly.
This is my case:
-If I use dragPromisedFilesOfTypes(…)
, everything works ok. I drag my image to any folder, I can name the file as I want using namesOfPromisedFilesDroppedAtDestination(…)
, etc, BUT the dragged image is just an icon and I can't provide a dragging image since the aforementioned method is not longer available.
-If I use beginDraggingSessionWithItems(…)
instead, I can provide a dragging image in mouseDragged(theEvent)
method BUT then nothing happens when I drop the image into Finder. I could use
draggingSession(_:endedAtPoint:operation:)
method to save the image manually when the operation ends but this method doesn't have any info about drop destination url and namesOfPromisedFilesDroppedAtDestination(…)
is not called in this case.
So, what am I missing? I guess this is a simple operation and shouldn't be that complicated. Apple documentation and googled tutorials are always using the deprecated method so I don't have any valid example to see where is my mistake. Please help.