title: How to add an object to a programmatically bound NSMutableArray?
body: <p>I have an NSDocument which has the following structure:</p>
  
  <pre><code>@interface MyDocument : NSDocument
  {
      NSMutableArray *myArray;
  
      IBOutlet NSArrayController *myArrayController;
      IBOutlet MyView *myView;
  }
  @end
  </code></pre>
  
  <p>I instantiate the NSArrayController and the MyView in MyDocument.xib, and have made the connections to the File's Owner (MyDocument), so I am pretty sure that from the point of view of Interface Builder, I have done everything correctly.</p>
  
  <p>The interface for MyView is simple:</p>
  
  <pre><code>@interface MyView : NSView {
      NSMutableArray *myViewArray;
  }
  @end
  </code></pre>
  
  <p>Now, in <code>MyDocument windowControllerDidLoadNib</code>, I have the following code:</p>
  
  <pre><code>- (void)windowControllerDidLoadNib:(NSWindowController *) aController
  {
      [super windowControllerDidLoadNib:aController];
      [myArrayController setContent:myArray];
  // (This is another way to do it)    [myArrayController bind:@"contentArray" toObject:self withKeyPath:@"myArray" options:nil];
  
      [myView bind:@"myViewArray" toObject:myArrayController withKeyPath:@"arrangedObjects" options:nil];
  }
  </code></pre>
  
  <p>In the debugger, I have verified that <code>myViewArray</code> is an NSControllerArrayProxy, so it would appear that my programmatic binding is correct. However, when I try to add objects in MyView's methods to the MyView <code>myViewArray</code>, they do not appear to update the MyDocument's <code>myArray</code>. I have tried both of the following approaches:</p>
  
  <pre><code>[myViewArray addObject:value];
  [self addMyViewArraysObject:value];
  </code></pre>
  
  <p>(The second approach causes a compiler error, as expected, but I thought that the Objective-C runtime would "implement" this method per my limited understanding of KVO.)</p>
  
  <p>Is there something wrong with how I'm trying to update <code>myViewArray</code>? Is there something wrong with my programmatic binding? (I am trying to do this programmatically, because MyView is a custom view and I don't want to create an IB palette for it.)</p>