title: Share an image using UIActivityViewController
body: <p>I want to share an image using <code>UIActivityViewController</code>. I am able to display the text I want to share, but I can't really figure out how to add an image. Hope somebody could help me. Thanks!</p>
  
  <p>My code is displayed under "actionButton"</p>
  
  <pre><code>import UIKit
  
  class DetailViewController: UIViewController, UIScrollViewDelegate {
  
      @IBOutlet weak var scrollView: UIScrollView!
      @IBOutlet weak var myDetailedImageView: UIImageView!
  
      var myDetailedImageName: String?
      var nameString: String?
  
      override func prefersStatusBarHidden() -&gt; Bool {
          return true
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          //For setting max and min zoom
          scrollView.maximumZoomScale = 0.8
          scrollView.minimumZoomScale = 0.15
          scrollView.delegate = self
          //reset zoomzcale for new image
          self.scrollView.zoomScale = 0.15
          self.myDetailedImageView.image = UIImage(named: myDetailedImageName!)
      }
  
      @IBAction func actionButton(sender: AnyObject) {
          let firstActivityItem = NSString(string: myDetailedImageName!)
          let activityViewController : UIActivityViewController = UIActivityViewController(activityItems: [firstActivityItem], applicationActivities: nil)
          self.presentViewController(activityViewController, animated: true, completion: nil)
      }
  
      //Showing what to zoom/scroll
      func viewForZoomingInScrollView(scrollView: UIScrollView) -&gt; UIView? {
          //returning image to reload it self
          return myDetailedImageView
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  }
  </code></pre>