I am trying to add a custom activity to my UIDocumentBrowserController long-tap menu - a UIActivityViewController. The default share activity, when selected, is pointing nicely to the icon of the file that the user just long-tapped.
How can I get the sourceRect so that my activity could be presented in a similar way?
let shareBundle = UIDocumentBrowserAction(identifier:
"com.mycompany.myapp.shareBundle", localizedTitle: "Share with Data",
availability: [.menu], handler: { urls in
if urls.count > 0 {
let objectsToShare: [URL] = [urls]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
activityVC.popoverPresentationController?.sourceView = self.view
activityVC.popoverPresentationController?.sourceRect = // That's the problem!
self.present(activityVC, animated: true, completion: nil)
}
})