Skip to content

Instantly share code, notes, and snippets.

@paul1893
Last active January 2, 2018 12:56
Show Gist options
  • Save paul1893/9107ac57f7d2589ce51147c8cd7e4355 to your computer and use it in GitHub Desktop.
Save paul1893/9107ac57f7d2589ce51147c8cd7e4355 to your computer and use it in GitHub Desktop.
func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal {
let dropLocation = session.location(in: view)
let operation: UIDropOperation
if selectedImageView.frame.contains(dropLocation) {
if session.localDragSession == nil { // Drag come frome the app
operation = .copy
} else { // Drag come from a third app
operation = .move
}
} else {
operation = .cancel
}
return UIDropProposal(operation: operation)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment