collectionView(_:performDropWith:) is not called

I've got a UICollectionView and I'm trying to drag and drop items within the view (document items unto a folder item to move it to a folder). I implemented the `collectionView(_:itemsForBeginning:at:)` method and that gets called. I provide some drag items. The drag starts working but when I let go, the item animates back to it's original position, and nothing gets called. Why is it not dropping?

Answered by rnikander in 413674022

It now works, only if I implement another method of UICollectionViewDropDelegate:


collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, 
               withDestinationIndexPath destinationIndexPath: IndexPath?)


This isn't mentioned in the WWDC talk (2017 - Data Delivery with Drag and Drop), and the docs claim that only the `...performDropWith...` delegate method is required, so I don't know why in my situation I get no drop unless I implement this method.

Accepted Answer

It now works, only if I implement another method of UICollectionViewDropDelegate:


collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, 
               withDestinationIndexPath destinationIndexPath: IndexPath?)


This isn't mentioned in the WWDC talk (2017 - Data Delivery with Drag and Drop), and the docs claim that only the `...performDropWith...` delegate method is required, so I don't know why in my situation I get no drop unless I implement this method.

Thanks for the feedback. Don't forget to close the thread by marking your correct answer.

I suppose I can mark it, but I don't know that it's the best answer. For all I know, I'm doing something else that I shouldn't be, which causes me to need the second method.

collectionView(_:performDropWith:) is not called
 
 
Q