title: Segue UI Image to ViewController with Swift
body: <p>I'm trying to pass an uiimage to my secondViewController but keep running into an error with my coding.  How can i segue uiimage to my secondViewController? </p>
  
  <p>viewController.swift</p>
  
  <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  
      if (segue.identifier == "test") {
  
         let destViewController : SecondViewController = segue.destinationViewController as SecondViewController
  
          destViewController.mainpictures = "background"
      }
  </code></pre>
  
  <p>SecondViewController</p>
  
  <pre><code>class SecondViewController: UIViewController {
  
      var mainpictures = String ()
  
      @IBOutlet var mainImage: UIImageView!
  
      override func viewDidLoad() {
  
          self.mainImage.text = mainpictures
  
          super.viewDidLoad()
      }
  </code></pre>