I'd like to add the .draggable() modifier to some of my List items like this:
.draggable(linksController.selectedItems.compactMap({ item in
item.url
}))
However I get the error message:
Instance method 'draggable' requires that '[URL]' conform to 'Transferable'
One URL alone works fine, but not an array of URLs.
I've tried to extend Array in order to conform to Transferable, but I'm not sure how to do it correctly. This is what I have got so far:
extension Array<URL>: Transferable {
public static var transferRepresentation: some TransferRepresentation {
CodableRepresentation(contentType: .url)
ProxyRepresentation(exporting: \.???)
}
}
Am I on the right path? Did anyone manage to use an array of URLs as Transferable?