In my app the users can click a share button which shows all the possible installed applications that are capable of sending a NSURL
. When the user clicks Mail
I want to repopulate the subject field (I'm already populating the body, which is working). Additionally when the user clicks SMS
then I want to have a different message than when the user clicked Mail
Is this possible to do?
This is what I'm doing currently but not sure how to customize the message for Mail
vs. SMS
activity_vc = UIActivityViewController.alloc.initWithActivityItems(["Check it out!",
NSURL.URLWithString("http://myurl.com/?id="+@item_id.to_s)], applicationActivities:nil)
activity_vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical
activity_vc.excludedActivityTypes = [
UIActivityTypeAddToReadingList,
UIActivityTypeAirDrop,
UIActivityTypeCopyToPasteboard,
UIActivityTypePrint
]
@delegate.presentViewController(activity_vc, animated:true, completion:nil)
You should be able to do this using setValue(forKey:)
activity_vc.setValue('Populated subject field', forKey: 'subject')