> On Jul 26, 2019, at 10:50, Dragan Milić via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
>> pet 26.07.2019., at 03.08, Rob Petrovec wrote:
>> 
>> I would not recommend using those deprecated API.  They are not long for 
>> this world.  With that said, I don’t have a better solution.
> 
> Yeah, I’d like ti avoid using that too.
> 
> 
>> pet 26.07.2019., at 03.30, Steve Mills via Cocoa-dev wrote:
>> 
>> Yeah, hard to say how much longer they'll be available. You could always add 
>> a single item using a custom NSPasteboardWriting class and supply your own 
>> image. It would hold the multiple items and write them.
> 
> The thing is, in that dragging session I have to supply a list of URLs, so 
> that other applications expecting URLs (like Finder, for example) would 
> accept them. As a matter of fact, speaking about specifics, what I really 
> want is to do is drag a couple of URLs into System Preferences’ “Full Disk 
> Access” list, and that one accepts only lists of URLs, as far as I know.
> 
> Now, I want it to look like a user is only dragging an icon of my application 
> (which he/she really does), but application’s privileged helper needs to be 
> added into “Full Disk Access” too. I don’t want user to see that (and 
> potentially get confused), so my intention is to show just application’s icon 
> during the drag. That works okay (the second dragging items has no content), 
> but since I actually have two dragging items, the count badge appears, and 
> that doesn’t look very nice.
> 
> Speaking of above mentioned deprecated method, I tried to use it and write 
> URLs to the dragging pasteboard using -[NSPasteboard writeObjects:]. That 
> worked well and looked exactly as I wanted on Mojave, but on Catalina it 
> throws exception for “there are two dragging items but only one dragging 
> image, there should be one image per item”.
> 
> Finally, I know of application which does exactly the same as I described and 
> want. The session contained three dragging items, but the badge was hidden. 
> So I thought there could be something obvious I may be missing. Now it seems 
> to me that only can be done through private API calls and/ore other hackery.
> 
> Cheers,
> -- Dragan
You want to look at the hairy block property of NSDraggingItem.h

@property (nullable, copy) NSArray<NSDraggingImageComponent *> * __nonnull 
(^imageComponentsProvider)(void);

It's been years ago now, but Raleigh Ledet did a WWDC presentation on Drag 
Flocking.
See
https://developer.apple.com/videos/play/wwdc2011/115/

It's one of the most intensely valuable videos for understanding scrolling, 
swiping and dragging in macOS. Still very very very valuable video.
It's a dense presentation, but if you *can* do this, this is where you will 
find out how.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to