I have created a NSCollectionViewItem
subclass, called TSCollectionViewController
. It overrides one method, setRepresentedObject:
. I plan on using it in my NSView
, TSTopChartView
. Oddly enough, I get an error when I add it to the TSTopChartView.h
file (pictured below).
Obviously, Xcode doesn't like TSCollectionViewController
for this file. I just can't figure out why! I've imported the file, so it shouldn't be an unknown type name. Any ideas? Thank you for your time!
Here is TSCollectionViewController.h:
#import <Cocoa/Cocoa.h>
#import "TSTopChartCell.h"
#import "TSPodcastEpisodeCell.h"
#import "TSDetailView.h"
@interface TSCollectionViewController : NSCollectionViewItem
@end
You have a circular #import dependency between TSCollectionViewController.h and TSTopChartView.h. In your case you can break it easily by removing
#import "TSTopChartCell.h"
from TSCollectionViewController.h.If you end up in a case where you really need the class
TSTopChartCell
to be declared in TSCollectionViewController.h you can fix this by adding@class TSTopChartCell
instead of the#import "TSTopChartCell.h"
. Then you can actually#import "TSTopChartCell.h"
in the implementation file, TSCollectionViewController.m.