Created
September 22, 2017 22:12
-
-
Save iAmrSalman/8fbadfd45736b740fe0f64a1aae268ad to your computer and use it in GitHub Desktop.
[sharing] #swift
This file contains hidden or 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
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