title: Pass data between view controller segue
body: <p>My first view controller, <code>AllAthletes</code>, is a uitableview of all my core data entities. It displays the entity "athlete" and it's properties in a subtitle style table cell such as first name, etc.. When you click on a view cell, I want this view controller to pass the information of the entity that was selected but i'm unsure on how to pass this information (managedobject, entity, properties, etc of indexpath) along to the detail view controller. Could someone please point me in the right direction?</p>
  
  <p>allathletes.m</p>
  
  <pre><code>-(void)viewWillAppear:(BOOL)animated{
      AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
      _managedObjectContext = [appDelegate managedObjectContext];
  
      NSFetchRequest *request = [[NSFetchRequest alloc] init];
      NSEntityDescription *athlete = [NSEntityDescription entityForName:@"Athlete" inManagedObjectContext:_managedObjectContext];
      [request setEntity:athlete];
      NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"first" ascending:YES];
      NSArray *sortDescriptors = [[NSArray alloc]initWithObjects:sortDescriptor, nil];
      [request setSortDescriptors:sortDescriptors];
  
      NSError *error = nil;
      NSMutableArray *mutableFetchResults = [[_managedObjectContext executeFetchRequest:request error:&amp;error] mutableCopy];
      if (mutableFetchResults == nil){
          //handle error
      }
      [self setAthleteArray:mutableFetchResults];
      [self.tableView reloadData];
  }
  
  
  
   //this is what I have so far
   - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
   {
       if ([segue.identifier isEqualToString:@"setAthlete"]) {
           NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
           AthleteDetail *destViewController = segue.destinationViewController;
       }
   }
  
  //i was also thinking something like this?
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
      UIViewController* detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailViewController"];
      NSMutableString *object = thisArray[indexPath.row];
      detailViewController.passedData = object;
      [self.navigationController pushViewController:detailViewController animated:YES];
  }
  </code></pre>
  
  <p>The second controller that it pushes you to is AthleteDetail. Thank you for your time.</p>