The new iOS 13 share sheet provides a nice header that shows the context of the item being shared.
I haven't been able to figure out how to change the item description though. I've used activityViewControllerLinkMetadata function which partially gives me what I need (changing title & icon), but originalURL, which is responsible for showing the item description, only accepts URL and every string has to be escaped if we create a URL from string (space to %20, for example).
@available(iOS 13.0, *)
func activityViewControllerLinkMetadata(_: UIActivityViewController) -> LPLinkMetadata? {
let metadata = LPLinkMetadata()
metadata.title = song.title
if let data = song.artistNames.data(using: .utf8) {
let url = URL(dataRepresentation: data, relativeTo: nil)
metadata.originalURL = URL(dataRepresentation: data, relativeTo: nil)
if let image = image {
metadata.iconProvider = NSItemProvider(object: image)
}
}
return metadata
}
App Store and Music app can do this - has anyone figured this out?
This is really silly, but this is how to do it.
metadata.originalURL = URL(fileURLWithPath: "whatever description you want to put")
And as a note, you don't have to create the file/folder itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With