I have a one-section collection view and would like to implement Drag and Drop to allow reordering of the items. The CollectionViewItem
has several textviews showing properties form my Parameter objects. Reading the doc I need to implement the NSCollectionView
delegate
:
func collectionView(_ collectionView: NSCollectionView, pasteboardWriterForItemAt indexPath: IndexPath) -> NSPasteboardWriting? {
let parameter = parameterForIndexPath(indexPath: indexPath)
return parameter // throws an error "Cannot convert return expression of type 'Parameter' to return type 'NSPasteboardWriting?'"
}
I have not found any information understandable for me describing the nature of the NSPasteboardWriting
object. So, I have no idea how to proceed...
What is the NSPasteboardWriting
object and what do I need to write in the pasteboard?
Thanks!
let REORDER_SOURCELIST_PASTEBOARD_TYPE = "com.yourdomain.sourcelist.item"
. What is "yourdomain" and do I need to change it to something that fits to my app? What do you mean with "that I define outside my class..."? What do you mean with outside the class? Thanks – Thanatopsis