Reputation: 303
For sharing message I use UIActivityViewController
.
Code:
let textShare = [ "text" ]
let activityViewController = UIActivityViewController(activityItems: textShare , applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self?.view
present(activityViewController, animated: true, completion: nil)
But I need to change text for different application, so my question is:
How I can check what application(for example mail or skype), user choose for sharing text?
Upvotes: 1
Views: 691
Reputation:
Use completionWithItemsHandler of UIActivityViewController to telled which application selected by user shared the content.
activityVC.completionWithItemsHandler = {(activityType: UIActivityType?, completed: Bool, returnedItems: [Any]?, error: Error?) in
if !completed {
// User canceled
return
}
// User completed activity
}
self.present(activityVC, animated: true, completion: nil)
Upvotes: 2