Post

Replies

Boosts

Views

Activity

Comment on
Hmm, I'm not sure that's relevant though? .onDrop() doesn't use Transferable, it passes me NSItemProvider objects. I am applying this to a Table() which doesn't seem to support .dropDestination() (which would use Transferable), so I have to use .onDrop(). Edit: Scratch that, I had the view modifier too late in the chain.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Comment on
Actually it seems like .dropDestination is fine, I was applying it too late in my viewmodifier chain. However, as far as I can tell, the ordering of Transferable representations is not universally respected. Here is another example project that offers to import three representations - a ProxyRepresentation for a URL, a FileRepresentation and a DataRepresentation. Try dragging an image onto the Table from Finder. https://github.com/cmsj/SwiftUITransferableOrderWrong
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Comment on
Thanks, that gets me working with the screenshot previews. It does seem like there is still a mildly undesirable behaviour though - in my actual app I now have a ProxyRepresentation for URL and then a FileRepresentation for .image and macOS will still prefer to give me the FileRepresentation for any kind of image file. That means I'm then dealing with a non-original file which is not entirely optimal, but I can live with it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25