Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Created November 10, 2017 10:59
Show Gist options
  • Save pgpt10/ed4f57caffcbb9def81e439a8cc4b729 to your computer and use it in GitHub Desktop.
Save pgpt10/ed4f57caffcbb9def81e439a8cc4b729 to your computer and use it in GitHub Desktop.
func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal
{
if session.localDragSession != nil
{
if collectionView.hasActiveDrag
{
return UICollectionViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
}
else
{
return UICollectionViewDropProposal(operation: .copy, intent: .insertAtDestinationIndexPath)
}
}
else
{
return UICollectionViewDropProposal(operation: .forbidden)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment