I have a simple 1 section NSCollectionView
and become crazy about not getting the drag and drop working. The collection view has custom collection view item with labels showing the data of custom objects. everything works until the point where the dragged item should get dropped between the new position. But when I drag the item there is no drop indicator (usually a gap) at the drop destination. I found out that the following NSCollectionView
delegate is not getting called.
func collectionView(_ collectionView: NSCollectionView, validateDrop draggingInfo: NSDraggingInfo,
proposedIndexPath proposedDropIndexPath: AutoreleasingUnsafeMutablePointer<NSIndexPath>,
dropOperation proposedDropOperation: UnsafeMutablePointer<NSCollectionViewDropOperation>) -> NSDragOperation {
print("validateDrop", proposedDropIndexPath) // never shows up in the console
if proposedDropOperation.pointee == NSCollectionViewDropOperation.on {
proposedDropOperation.pointee = NSCollectionViewDropOperation.before
}
print("validateDrop", proposedDropIndexPath)
return NSDragOperation.move
}
What do I miss??? Thanks!
Edit 1
I only want to use drag and drop to allow reordering the items within the collection view. It is not intended to drag external content in the collection view.