title: Cocoa NSCollectionView not calling dataSource methods
body: <p>Having a brain fart and cannot figure out why the dataSource methods for NSCollectionView are not being called.</p>
  
  <p>All the samples that I'm coming across for NSCollectionView are using bindings. Even Apple's "Programming Guide" is extremely short and vague compared to most of their other programming guides which are usually amazing.</p>
  
  <p>I have a sandbox test setup just to test this. I'm loading images from dribbble.com.</p>
  
  <p>Here's my AppDelegate.h:</p>
  
  <pre><code>#import &lt;Cocoa/Cocoa.h&gt;
  #import "Dribbble.h"
  
  @interface AppDelegate : NSObject &lt;NSApplicationDelegate,NSCollectionViewDataSource,NSCollectionViewDelegate&gt;
  @property IBOutlet NSCollectionView * collectionView;
  @end
  </code></pre>
  
  <p>And AppDelegate.m </p>
  
  <pre><code>#import "AppDelegate.h"
  #import "DribbbleCell.h"
  
  @interface AppDelegate ()
  
  @property (weak) IBOutlet NSWindow *window;
  @property Dribbble * dribbble;
  @property NSMutableArray * dribbbleShots;
  @property NSInteger page;
  @property NSInteger maxPage;
  @end
  
  @implementation AppDelegate
  
  - (void) applicationDidFinishLaunching:(NSNotification *) aNotification {
      self.page = 0;
      self.maxPage = 1;
      self.dribbbleShots = [NSMutableArray array];
  
      self.dribbble = [[Dribbble alloc] init];
      self.dribbble.accessToken = @"XXXX";
      self.dribbble.clientSecret = @"XXXX";
      self.dribbble.clientId = @"XXXX";
  
      NSNib * nib = [[NSNib alloc] initWithNibNamed:@"DribbbleCell" bundle:nil];
      [self.collectionView registerNib:nib forItemWithIdentifier:@"DribbbleCell"];
  
      self.collectionView.dataSource = self;
      self.collectionView.delegate = self;
  
      [self loadDribbbleShots];
  }
  
  - (void) loadDribbbleShots {
      self.page++;
  
      //this loads 100 shots up to max pages.
      [self.dribbble listShotsWithParameters:@{@"per_page":@"100",@"page":[NSString stringWithFormat:@"%lu",self.page]} completion:^(DribbbleResponse *response) {
          [self.dribbbleShots addObjectsFromArray:response.data];
          if(self.page &lt; self.maxPage) {
              [self performSelectorOnMainThread:@selector(loadDribbbleShots) withObject:nil waitUntilDone:FALSE];
          } else {
              [self finishedDribbbleLoad];
          }
      }];
  }
  
  - (void) finishedDribbbleLoad {
      //how do I reload collection view data?
      [self.collectionView setContent:self.dribbbleShots];
      [self.collectionView reloadData];
      [self.collectionView setNeedsDisplay:TRUE];
  }
  
  //** None of the below methods are being called.
  
  - (NSInteger) numberOfSectionsInCollectionView:(NSCollectionView *)collectionView {
      return 1;
  }
  
  - (NSInteger) collectionView:(NSCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
      return self.dribbbleShots.count;
  }
  
  - (NSCollectionViewItem * ) collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath {
      DribbbleCell * cell =  (DribbbleCell *)[collectionView makeItemWithIdentifier:@"DribbbleCell" forIndexPath:indexPath];
      return cell;
  }
  
  @end
  </code></pre>
  
  <p>Everything except for the collection data source methods are being called.</p>
  
  <p>I've break-pointed and stepped through everything and made sure there's no nil pointers.</p>
  
  <p>I've checked and checked that the IBOutlet is not nil.</p>
  
  <p>The DribbbleCell class currently does nothing as i'm still trying to figure out why these data source methods aren't being called.</p>
  
  <p>What am I missing for NSCollectionView?</p>