diff --git a/Drag and Drop/DragDropDemo/DropViewController.swift b/Drag and Drop/DragDropDemo/DropViewController.swift index 698069d..af5fd25 100644 --- a/Drag and Drop/DragDropDemo/DropViewController.swift +++ b/Drag and Drop/DragDropDemo/DropViewController.swift @@ -71,7 +71,7 @@ extension DropViewController: UICollectionViewDropDelegate { } func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal { - let proposal = UICollectionViewDropProposal(dropOperation: .copy, intent: .insertAtDestinationIndexPath) + let proposal = UICollectionViewDropProposal(operation: .copy, intent: .insertAtDestinationIndexPath) return proposal } diff --git a/Drag and Drop/DragDropDemo/ImageDropViewController.swift b/Drag and Drop/DragDropDemo/ImageDropViewController.swift index d372037..3e7e333 100644 --- a/Drag and Drop/DragDropDemo/ImageDropViewController.swift +++ b/Drag and Drop/DragDropDemo/ImageDropViewController.swift @@ -60,21 +60,16 @@ extension ImageDropViewController: UICollectionViewDropDelegate { } } }) - - placeholderContext = coordinator.drop(item.dragItem, - toPlaceholderInsertedAt: destinationIndexPath, - withReuseIdentifier: "placeholderCell", - cellUpdateHandler: { (cell) in - guard let placeholderCell = cell as? ImagePlaceholderCollectionViewCell else { return } - placeholderCell.configure(with: progress) - }) + + let placeholder = UICollectionViewDropPlaceholder(insertionIndexPath: destinationIndexPath, reuseIdentifier: "placeholderCell") + placeholderContext = coordinator.drop(item.dragItem, to: placeholder) } coordinator.session.progressIndicatorStyle = .none } func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal { - let proposal = UICollectionViewDropProposal(dropOperation: .copy, intent: .insertAtDestinationIndexPath) + let proposal = UICollectionViewDropProposal(operation: .copy, intent: .insertAtDestinationIndexPath) return proposal }