Normally, we link the image from storyboard to viewcontroller by
IBOutlet
by this code:@IBOutlet private weak var resultImage: UIImageView!
we can update the image by calling this: resultImage.image = UIImage(named: "image")
. It works ok
However, when i call this in the prepare for segue, it found nil:
let destinationDetail = segue.destination as! RestaurantViewController destinationDetail.restaurantImage.image = UIImage(named: "image")
restaurantImage is an Outlet in RestaurantViewController: @IBOutlet weak var restaurantImage: UIImageView!
I dont understand why it found nil, please help!