title: How can I access an array from a different class and add more objects to it?
body: <p><strong>MasterViewController.h:</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface MasterViewController : UITableViewController
  
  @property (nonatomic, strong) NSMutableArray *listOfBugs;
  </code></pre>
  
  <p><strong>MasterViewController.m:</strong></p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      _listOfBugs = [[NSMutableArray alloc]init];
  }
  
  ...
  ...
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  
  {
      ScaryBugDoc *bug = [self.bugs objectAtIndex:indexPath.row];
      [_listOfBugs addObject:bug];
  }
  </code></pre>
  
  <p>In the above code I've created an array that holds objects with properties.
  I want to access the objects inside the array from a different class and also add objects to the same array. I know I can create a new array from the same class like this:</p>
  
  <p><strong>ListOfBugsViewController.m:</strong></p>
  
  <pre><code>#import "ListOfBugsViewController.h"
  #import "MasterViewController.h"
  MasterViewController *myClass = [[MasterViewController alloc]init];
  
  
      NSMutableArray *array = [myClass.listOfBugs....
  </code></pre>
  
  <p>But obviously that's not what I'm looking for. I want to access the objects that are already inside the array and not to create a new array. </p>
  
  <p><strong>Edit:</strong> To make things a bit simpler, I have a few classes and only one array I'm adding objects to. All classes should be able to add objects to it and read previously added objects.
  How can I access that same array from a class it wasn't allocated and initialized in?</p>
  
  <p>Thanks</p>