I need to share different items for activities type. For facebook:I have to share: text & url. but for Mail:I have to share text,image & url.
I have seen many questions but none answered my queries.
Below is the piece of code, How I'm doing it.
@IBAction func shareDetails(sender: AnyObject) {
var activityItemsArray:[AnyObject] = [SharingProvider(source: detail)]
if let urlString = dealer.websiteURL {
if let url = NSURL(string:urlString) {
activityItemsArray.append(url)
}
}
let shareVC = UIActivityViewController(activityItems: activityItemsArray, applicationActivities: nil)
shareVC.setValue("This is the Subject", forKey: "subject")
shareVC.completionWithItemsHandler = { (activityType:String!, completed:Bool, returnedItems:[AnyObject]!, error:NSError!) -> Void in
if !completed {
return
}
}
self.presentViewController(shareVC, animated: true, completion: nil)
}
I want to customize activityItemArray based on activityType. Any help will be appreciated. :)