I have implemented share functionality and after completion of it I just want to navigate to next page which works fine but for one case which is message, I want to hit an api but that api requires phone number of the tapped user. It’s like I open the share sheet, I tap on any random contact or tap message to create new one and after completion call the api and pass the phone number of tapped user or the user who I shared content with. I’m not able to access that.Is there any way to do that as after completion all I’m able to use is whether is completed or not. I read documentation and saw we can return some data printed items, they were nill too. It does tell after tapping a contact that it was message type but wont give me more data. Here is the code that I have done so far:
private func presentShareSheet() {
let url = "appUrl"
let customText = "Click this link: \(url)"
let activityViewController = UIActivityViewController(activityItems: [customText], applicationActivities: nil)
// Exclude certain activity types if needed
activityViewController.excludedActivityTypes = [
.airDrop,
.addToReadingList,
.assignToContact,
.markupAsPDF,
.openInIBooks,
.print,
.saveToCameraRoll
]
// Set the completion handler for the activity view controller
activityViewController.completionWithItemsHandler = { [weak self] activityType, completed, returnedItems, _ in
if completed {
self?.handleShareSheetCompletion()
} else {
// User canceled the activity view controller, handle the cancellation here
self?.handleShareSheetCancellation()
}
}
present(activityViewController, animated: true, completion: nil)
}
Is there any way to get details of the contact that I tapped on the share sheet or typed after clicking new message?