title: Passing Core Data objects to another view controller when selecting row from UITableView
body: <p>EDIT based on provided answer:</p>
  
  <pre><code>    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      selectedName = quizNames[indexPath.row]
      performSegueWithIdentifier("saveSegue", sender: self)
  }
  
  
  
      override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
          if segue.identifier == "saveSegue" {
              let inputController = segue.destinationViewController as? QAInputViewController
              inputController?.quizName = selectedName 
  
          }
      }
  </code></pre>
  
  <p>I have done some research on here trying to figure out exactly how to use prepareForSegue in order to pass the selected Core Data object from a UITableView cell to a second View Controller, but what i found and tried to implement did not work out for me as it seems some of the code might be outdated. Here is what i am trying to do:</p>
  
  <ol>
  <li><p>I populate a UITableView with an array of names of type Name which is my NSManagedObject. When i select a specific name it will segue me to an input screen where a question and answer will be submitted. I want to make sure that the question and answer that are submitted stay assigned to the previously selected name. I am not sure how to set this up in prepareForSegue. I did set up my data model with relationships, so if i did that correctly it should work once i understand how to implement it. Is there some way i can check the currently selected name so that i know any question and answer that is inputted will be saved to that name?</p></li>
  <li><p>Relative to my above question, i want the title of the second View Controller to show the name of the previously selected name. </p></li>
  </ol>
  
  <p>Basically i am just looking for the guidance on to get this implemented in Swift 2. Thank you very much for your help. </p>
  
  <p>EDIT: <a href="https://stackoverflow.com/questions/32098461/passing-core-data-objects-from-uitableviewcell-to-another-view-controller">Passing Core Data objects from UITableViewCell to another View Controller</a></p>
  
  <p>The above link is the solution i tried implementing that was not working for me. Specifically:</p>
  
  <pre><code> override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  
      if segue.identifier == "showTaskDetail" {
          let detailVC: TaskDetailViewController = segue.destinationViewController as! TaskDetailViewController
          let indexPath = self.tableView.indexPathForSelectedRow()
          let thisTask = fetchedResultsController.objectAtIndexPath(indexPath!) as! TaskModel
          detailVC.detailTaskModel = thisTask
          detailVC.delegate = self
  
      }
  </code></pre>