As of iOS 14, UICollectionViewDiffableDataSource has a reorderHandlers
property. It's demonstrated in some sample code and talked about in WWDC 2020 session on Advances in Diffable Data Sources. The presenter states that you have to provide a canReorder
and didReorder
closure to enable the feature.
The sample code uses it in a collection view with a list layout configuration, and configures the list cells with reorder accessories. The canReorder
and didReorder
methods are called as expected. But if I remove the reorder accessories from the cells, reordering no longer works - it doesn't call either closure. It also doesn't work in my app, where I have a grid layout using a compositional layout.
How do I enable reordering on UICollectionViewDiffableDataSource
without list cells and reorder accessories?