UICollectionViewDiffableDataSource reorderingHandlers not working

I added the code below to the collectionview using UICollectionViewDiffableDataSource.
However, I can not drag the cells. (mysteriously, I can drag cells on Mac Catalyst)
What is missing?

Code Block swift
dataSource.reorderingHandlers.canReorderItem = { item in return true }
dataSource.reorderingHandlers.didReorder = { [weak self] transaction in
guard let self = self else { return }
if let updatedBackingStore = self.backingStore.applying(transaction.difference) {
self.backingStore = updatedBackingStore
}
}

Answered by frnkwk in 636658022
I found the way to solve it.
Just implement empty UICollectionViewDragDelegate & UICollectionViewDropDelegate methods.

Code Block swift
extension ReorderableCollectionViewController: UICollectionViewDragDelegate {
    func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
        return []
    }
}
extension ReorderableCollectionViewController: UICollectionViewDropDelegate {
    func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) {
   
}
}


Accepted Answer
I found the way to solve it.
Just implement empty UICollectionViewDragDelegate & UICollectionViewDropDelegate methods.

Code Block swift
extension ReorderableCollectionViewController: UICollectionViewDragDelegate {
    func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
        return []
    }
}
extension ReorderableCollectionViewController: UICollectionViewDropDelegate {
    func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) {
   
}
}


UICollectionViewDiffableDataSource reorderingHandlers not working
 
 
Q