Hello there!
UIDocumentInteractionController.name property doesn't seem to work as documented. Here's the sample code:
class ViewController: UIViewController {
// ...
func showShareController(with sourceView: UIView) {
// ...
let attachment = MyAttachment(name: "MyDoc.pdf", url: URL(string: "path/to/<MyDocInternalUUIDName>.pdf")!, uti: UTType(mimeType: "application/pdf"))
let sourceViewRect = view.convert(sourceView.bounds, from: sourceView)
documentInteractionController = UIDocumentInteractionController(url: attachment.url)
documentInteractionController?.uti = attachment.uti?.identifier
documentInteractionController?.name = attachment.name
documentInteractionController?.delegate = self
documentInteractionController?.presentOptionsMenu(
from: sourceViewRect,
in: view,
animated: true
)
}
}
The share sheet is presented successfully, as well the file is available to share via some service (I've used AirDrop from the test device to my MacBook). However, in the navigation bar I see the internal UUID filename, and it's shared to my MacBook with the very same name:
Is this a bug or am I missing something?