Skip to content

Instantly share code, notes, and snippets.

@MikeTradr
Created December 14, 2016 17:07
Show Gist options
  • Save MikeTradr/8a36714566b3e1cab5a2da09af317ff6 to your computer and use it in GitHub Desktop.
Save MikeTradr/8a36714566b3e1cab5a2da09af317ff6 to your computer and use it in GitHub Desktop.
func shareCell (actionType:String, image:UIImageView) {
switch (actionType){
case "textImage":
let objectsToShare = [image]
let activityVC = UIActivityViewController(
activityItems: objectsToShare,
applicationActivities: nil
)
let mailSubject:String = "🗓 My Event..."
activityVC.setValue(mailSubject, forKey: "Subject")
activityVC.completionWithItemsHandler = {
(activityType, completed, items, error) in
guard completed else { print("User cancelled."); return }
print("Completed With Activity Type: \(activityType)")
}
// must be PopOver on iPad --- will be ignored on iPhone
//TODO FIX activityVC.popoverPresentationController?.barButtonItem = sender as? UIBarButtonItem
self.presentViewController(activityVC, animated: true, completion: nil)
break;
default:
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment