title: Push segue from UITableViewCell to ViewController in Swift
body: <p>I'm encountering problems with my UITableViewCells. I connected my UITableView to a API to populate my cells. </p>
  
  <p>Then I've created a function which grabs the <code>indexPath.row</code> to identify which JSON-object inside the array that should be sent to the <code>RestaurantViewController</code>. </p>
  
  <blockquote>
    <p><a href="https://mega.co.nz/#!t89CiAKD!qOemhVZ6yCNDfsc-H43Yk4vady7yIqUx3V9d-4NrglQ" rel="noreferrer">Link to my Xcode Project for easier debugging and problem-solving</a></p>
  </blockquote>
  
  <p>Here's how my small snippet looks for setting the "row-clicks" to a global variable.</p>
  
  <pre><code>func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
       i = indexPath.row
  }
  </code></pre>
  
  <p>And here's my <code>prepareForSegue()</code> function that should hook up my push-segue to the <code>RestaurantViewController</code>.</p>
  
  <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
      if segue.identifier == "toRestaurant"{
      let navigationController = segue.destinationViewController as UINavigationController
      let vc = navigationController.topViewController as RestaurantViewController
      vc.data = currentResponse[i] as NSArray
   }
  }
  </code></pre>
  
  <p>And here's how I've set up my segue from the <code>UITableViewCell</code>
  <img src="https://i.stack.imgur.com/gRQbL.png" alt=""></p>
  
  <p>Here's my result, I've tried to click every single one of these cells but I won't be pushed to another viewController...I also don't get an error. What is wrong here?</p>
  
  <p><img src="https://i.stack.imgur.com/dlMRV.jpg" alt=""></p>
  
  <blockquote>
    <p>Tried solutions that won't work</p>
  </blockquote>
  
  <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
          if segue.identifier == "toRestaurant"{
              let vc = segue.destinationViewController as RestaurantViewController
              //let vc = navigationController.topViewController as RestaurantViewController
              vc.data = currentResponse[i] as NSArray
          }
      }
  </code></pre>