title: Pass data between viewcontroller with out segues
body: <p>I was able to move from one <code>ViewController</code> to another programmatically without any story board, now come the part where I need to transfer the data, in my <code>rootViewController</code>, I have data in this form:</p>
  <pre><code>var restaurants:[Restaurant] = [
            Restaurant(name: &quot;Cafe Deadend&quot;,  image: &quot;cafedeadend.jpg&quot;, isVisited: false),
            Restaurant(name: &quot;Homei&quot;, image: &quot;homei.jpg&quot;, isVisited: false) ]
  </code></pre>
  <p>And  of course  <code>Restaurant</code> is a class in my model section ....</p>
  <p>Now in my rootcontroller i move to my other controller like this ......</p>
  <pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          
          let detailView: DetailViewController = DetailViewController()
          
         
           detailView.restaurant = restaurants[indexPath.row]
          self.navigationController?.pushViewController(DetailViewController(), animated: false)
          
          
      }
  </code></pre>
  <p>And of course in my <code>DetailViewController</code> I have this</p>
  <pre><code>var restaurant = Restaurant()
  </code></pre>
  <p>But here when I try to show an image like this in <code>DetailViewController</code>, expecting the image name to come with the code in <code>RestaurantViewController</code> I get nil....</p>
  <pre><code>let imageHeader = UIImageView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
  imageHeader.image = UIImage(named: self.restaurant.image)
  </code></pre>
  <p>I am always getting nil value for the image, where I should be getting the string name of image, can any one please guide where I have gone wrong and why the value is not getting transferred from one controller to other.</p>