Goal: implement a sharesheet (UIActivityViewController) that includes Gmail as an option, and sets the recipient and subject
Problem: setting subject works, but setting recipient (forKey: "to") crashes the program.
I would like to have the ability to set the sender and recipient field of the share sheet email client, but so far I have been unable to find any way of doing this. Any help is appreciated!
Relevant code:
let email = ["[email protected]"] let activityVC = UIActivityViewController(activityItems: [""], applicationActivities: nil) activityVC.excludedActivityTypes = excludedActivity activityVC.setValue("Subject Title", forKey: "subject") activityVC.setValue(email[0], forKey: "to") activityVC.popoverPresentationController?.sourceView = self.view self.presentViewController(activityVC, animated: true, completion: nil)