dropInteraction for files other than images?

How can I use dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) to accept other type of files than images? Say for instnce that I drag a PDF or MP3 from the files app. How can I accept this file and get the data?

Replies

I'm working on this as well. Will post if I get anything working.

dropInteraction relies on UTIs, so it should just be a matter of adding the appropriate one for the asset(s) you expect to work with/support.


See https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/UniformTypeIdentifier.html

I have the same problem and not figured out a solution yet - has anybody else figured it out?