The method uses a UIActivityViewController , for example, as follows:
@IBAction func shareSheet(sender: AnyObject) { let firstActivityItem = "Text you want" let secondActivityItem : NSURL = NSURL(string: "http//:urlyouwant")!
The above code works for both iPhone and iPad, because when you install the new popoverPresentationController in iOS 8, it works for iPad popoverPresentationController .
If using UIBarButtonItem you need to replace this line:
activityViewController.popoverPresentationController?.sourceView = (sender as! UIButton)
With the help of this:
activityViewController.popoverPresentationController?.barButtonItem = (sender as! UIBarButtonItem)
Hope this helps you.
Victor sigler
source share