Skip to content

Instantly share code, notes, and snippets.

@icanswiftabit
Last active November 16, 2017 10:37
Show Gist options
  • Save icanswiftabit/4cfdf78d834e1078df7f6803e0761659 to your computer and use it in GitHub Desktop.
Save icanswiftabit/4cfdf78d834e1078df7f6803e0761659 to your computer and use it in GitHub Desktop.
for item in coordinator.items {
let placeholder = UICollectionViewDropPlaceholder(insertionIndexPath: destinationIndexPath, reuseIdentifier: PlaceholderCollectionCell.identifier)
let placeholderContext = coordinator.drop(item.dragItem, to: placeholder)
item.dragItem.itemProvider.loadObject(ofClass: Cat.self) { cat, error in
DispatchQueue.main.async {
placeholderContext.commitInsertion { insertionIndexPath in
self.viewModel.cats.insert(cat as! Cat, at: insertionIndexPath.row)
}
}
}
}
coordinator.session.progressIndicatorStyle = .none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment