Skip to content

Instantly share code, notes, and snippets.

@paul1893
Last active January 2, 2018 13:17
Show Gist options
  • Save paul1893/c5eb9d85ee01c1cfc68d78faa584c887 to your computer and use it in GitHub Desktop.
Save paul1893/c5eb9d85ee01c1cfc68d78faa584c887 to your computer and use it in GitHub Desktop.
func dragInteraction(_ interaction:UIDragInteraction, previewForLifting item:UIDragItem, session:UIDragSession) -> UITargetedDragPreview? {
let imageView = UIImageView(image: UIImage(named: "MyDragImage"))
let dragView = interaction.view!
let dragPoint = session.location(in: dragView)
let target = UIDragPreviewTarget(container: dragView, center: dragPoint)
return UITargetedDragPreview(view: imageView, parameters:UIDragPreviewParameters())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment