Last active
January 28, 2018 08:58
-
-
Save rtking1993/36e4191190bff961c0d901640b572ffd to your computer and use it in GitHub Desktop.
ShareSheet Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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