Skip to content

Instantly share code, notes, and snippets.

@CibelePaulinoAndrade
Created August 9, 2018 17:24
Show Gist options
  • Save CibelePaulinoAndrade/c7078000c8db1b0b322b1de13167b0ea to your computer and use it in GitHub Desktop.
Save CibelePaulinoAndrade/c7078000c8db1b0b322b1de13167b0ea to your computer and use it in GitHub Desktop.
performDrop - Drag and Drop
func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) {
if session.canLoadObjects(ofClass: String.self) {
session.loadObjects(ofClass: String.self) { (items) in
let values = items as [String]
self.dropTextView.text = values.last
}
} else if session.canLoadObjects(ofClass: UIImage.self) {
session.loadObjects(ofClass: UIImage.self) { (items) in
let images = items as! [UIImage]
self.dropImageView.image = images.last
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment