Skip to content

Instantly share code, notes, and snippets.

@rtking1993
Last active January 28, 2018 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtking1993/36e4191190bff961c0d901640b572ffd to your computer and use it in GitHub Desktop.
Save rtking1993/36e4191190bff961c0d901640b572ffd to your computer and use it in GitHub Desktop.
ShareSheet Extension
import UIKit
// Extension
extension UIViewController {
func presentShareSheet(for object: Object) {
guard let text = object.text,
let image = object.image,
let url = object.url else {
return
}
let activityViewController = UIActivityViewController(activityItems: [text, image, url], applicationActivities: [])
viewController.present(activityViewController, animated: true, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment