When I do the animation individually, everything works fine, but inside the performBatchUpdates block performBatchUpdates change is instantaneous, almost like I called reloadData() . Am I using it correctly?
Working method:
NSAnimationContext.currentContext().duration = 0.25 indexPathChanges.map({collectionView.animator().moveItemAtIndexPath($0.0, toIndexPath: $0.1)})
performBatchUpdates version (instant change - no animation):
NSAnimationContext.currentContext().duration = 0.25 collectionView.performBatchUpdates( { indexPathChanges.map({self.collectionView.moveItemAtIndexPath($0.0, toIndexPath: $0.1)}) // tried this as well - no luck // indexPathChanges.map({self.collectionView.animator().moveItemAtIndexPath($0.0, toIndexPath: $0.1)}) }, completionHandler: {(finished) in print("Finished: \(finished)")
source share