I'm working on an iOS app that allows the user to save/share a file using UIKit's UIActivityViewController.
One of the features we'd like to have in this iOS app is a little display that says something like "Project file was most recently saved as [some_file_name.project] at 8:32 AM", to allow the user to more easily keep track of when/where he last saved his data.
The problem is, UIKit's UIActivityViewController allows the user to choose a new file name for the file as part of the save operation (which is good), but we can't find any API calls that would allow our app to know what filename the user entered into the UIActivityViewController (which is bad).
Is there a way to find out that information? Relevant screenshots and code snippets are below, in case they are helpful.
/// Share a document located in a url. UIActivityViewController will be opened
/// - Parameters:
/// - url: url of the document to be shared
private func share(url: URL) {
let items = [url]
let activityVC = UIActivityViewController(activityItems: items, applicationActivities: nil)
if let popoverController = activityVC.popoverPresentationController, let viewContainer = self.parentViewController?.view {
popoverController.sourceRect = .zero
popoverController.sourceView = viewContainer
popoverController.delegate = self
}
activityVC.completionWithItemsHandler = {(activityType: UIActivity.ActivityType?, completed: Bool, returnedItems: [Any]?, error: Error?) in
if !completed {
return
}
self.activityViewControllerDidDismiss(url: url)
}
self.parentViewController?.present(activityVC, animated: true, completion: nil)
}

