Created
November 11, 2017 13:24
-
-
Save pgpt10/4ed60e87ca55da2aff20567b974616cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) | |
{ | |
let destinationIndexPath: IndexPath | |
if let indexPath = coordinator.destinationIndexPath | |
{ | |
destinationIndexPath = indexPath | |
} | |
else | |
{ | |
// Get last index path of collection view. | |
let section = collectionView.numberOfSections - 1 | |
let row = collectionView.numberOfItems(inSection: section) | |
destinationIndexPath = IndexPath(row: row, section: section) | |
} | |
switch coordinator.proposal.operation | |
{ | |
case .move: | |
//Add the code to reorder items | |
break | |
case .copy: | |
//Add the code to copy items | |
break | |
default: | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment