Last active
July 26, 2018 14:39
-
-
Save CibelePaulinoAndrade/c5c619292d8dfcb604df84856b343fe3 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 dragInteraction(_ interaction: UIDragInteraction, itemsForAddingTo session: UIDragSession, withTouchAt point: CGPoint) -> [UIDragItem] { | |
// Adicionar novos itens a seleção | |
if let textView = interaction.view as? UITextView { | |
let textToDrag = textView.text | |
let provider = NSItemProvider(object: textToDrag! as NSString) | |
let item = UIDragItem(itemProvider: provider) | |
return [item] | |
} | |
else if let imageView = interaction.view as? UIImageView { | |
guard let image = imageView.image else { return [] } | |
let provider = NSItemProvider(object: image) | |
let item = UIDragItem(itemProvider: provider) | |
return [item] | |
} | |
return [] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment