Skip to content

Instantly share code, notes, and snippets.

@iAmrSalman
Created September 22, 2017 22:12
Show Gist options
  • Save iAmrSalman/8fbadfd45736b740fe0f64a1aae268ad to your computer and use it in GitHub Desktop.
Save iAmrSalman/8fbadfd45736b740fe0f64a1aae268ad to your computer and use it in GitHub Desktop.
[sharing] #swift
func share(message: String, image: UIImage, completionHandler: (() -> Void)? = nil) {
let activityViewController = UIActivityViewController(activityItems: [message, image], applicationActivities: nil)
if let completionHandler = completionHandler {
activityViewController.completionWithItemsHandler = { _ in
completionHandler()
}
}
self.present(activityViewController, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment