Issue with .itemProvider on macOS 15.1

I have a List with draggable items. According to this thread (https://developer.apple.com/forums/thread/664469) I had to use .itemProvider instead of .onDrag, because otherwise the selection of the list will not work anymore.

The items in my list refer to a file URL. So the dragging allowed to copy the files to the destination of the drag & drop. Therefore I used this code

.itemProvider {
    let url = ....... // get the url with an internal function
    return NSItemProvider(object: url as NSURL)
}

Since the update to macOS 15.1 this way isn't working anymore. It just happens nothing.

I also tried to use

.itemProvider {
	let url = ....
	return NSItemProvider(contentsOf: url) ?? NSItemProvider(object: url as NSURL)
}

but this doesn't work too.

The same way with .onDrag works btw.

.onDrag {
    let url = ....... // get the url with an internal function
    return NSItemProvider(object: url as NSURL)
}

but as I wrote, this will break the possibility to select or to use the primaryAction of the .contextMenu.

Is this a bug? Or is my approach wrong and is there an alternative?

@joachim_me Have you tried using the draggable(_:) and dropDestination(for:action:isTargeted:) API's for drag and drop operation?

Adopting drag and drop using SwiftUI sample code would walk you through on how to implement drag and drop to receive Transferable items

Yes, I tried to use draggable, but it just happens nothing. But maybe I don't understand correctly how to implement it.

My model Document conforms to Codable:

List(selection: self.$selectedDocument) {
    ForEach(self.documents) { document in
        DocumentView(document)
            .draggable(document)
    }

and

extension Document: @retroactive Transferable {
	public static var transferRepresentation: some TransferRepresentation {
		FileRepresentation(exportedContentType: .data) { document in
			return SentTransferredFile(document.url)
		}
	}
}
Issue with .itemProvider on macOS 15.1
 
 
Q