title: Swift/iOS8: set imageView for next View Controller before Segue
body: <p>depending on a few parameters I am trying to set an Image on the second VC, but somehow it always returns null??</p>
  
  <p>this is what i do:</p>
  
  <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  
          if segue.identifier == "showDetail"  {
              println("going forth!")
              println(self.myButton.selected)
  
              let controller = segue.destinationViewController as? DetailVC
  
              if myButton.selected == true {
                  var newImage = UIImage(named:"Test1")
                  var oldImage = controller?.imageView.image
                  println(oldImage)
  
                  oldImage = newImage
              } else {
                  var newImage = UIImage(named:"Test2")
                  var oldImage = controller?.imageView.image
                  println(oldImage)
  
                  oldImage = newImage
              }
  
          } else {
              println("roflcopter")
          }
      }
  </code></pre>
  
  <p>the detail VC basically has "nothing": </p>
  
  <pre><code>import UIKit
  
  class DetailVC: UIViewController {
  
  
      @IBOutlet weak var imageView: UIImageView!
  
      var testString:String!
  
      @IBAction func goBacktoMain(segue: UIStoryboardSegue) {
  
          println("going back")
  
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          println("view Did Load")
          println(testString)
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  
  }
  </code></pre>
  
  <p>the second VC has a default image set via Storyboard but when I stop with a breakpoint @let controller it will tell me that imageview actually is null, does this only get set once the detail vc was shown once?</p>
  
  <p>€dit: setting the string and printing it out on the second VC works perfectly fine</p>