Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Last active November 11, 2017 17:27
Show Gist options
  • Save pgpt10/abef33ddd07bfa5140e1af53bc96c7f5 to your computer and use it in GitHub Desktop.
Save pgpt10/abef33ddd07bfa5140e1af53bc96c7f5 to your computer and use it in GitHub Desktop.
collectionView.performBatchUpdates({
var indexPaths = [IndexPath]()
for (index, item) in coordinator.items.enumerated()
{
//Destination index path for each item is calculated separately using the destinationIndexPath fetched from the coordinator
let indexPath = IndexPath(row: destinationIndexPath.row + index, section: destinationIndexPath.section)
self.items.insert(item.dragItem.localObject as! String, at: indexPath.row)
indexPaths.append(indexPath)
}
collectionView.insertItems(at: indexPaths)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment