Skip to content

Instantly share code, notes, and snippets.

@paul1893
Created January 2, 2018 10:13
Show Gist options
  • Save paul1893/baa5feeec12965b1e643dd52347bd92a to your computer and use it in GitHub Desktop.
Save paul1893/baa5feeec12965b1e643dd52347bd92a to your computer and use it in GitHub Desktop.
func dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession)
let itemProvider = NSItemProvider()
itemProvider.registerFileRepresentation(forTypeIdentifier: kUTTypeJPEG as String, fileOptions: [.openInPlace], visibility: .all){ completionHandler in
//Get Url
let url = Attachement.url(forName: self.contactCard.name)
completionHandler(url, true, nil)
return nil
}
let dragItem = UIDragItem(itemProvider: itemProvider)
return [dragItem]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment