Chris Muench
Chris Muench

Reputation: 18318

@protocol with @class defintition

I am reading through some code in AQGrid and came accross:

@protocol AQGridViewDataSource;
@class AQGridView, AQGridViewData, AQGridViewUpdateInfo;

@protocol AQGridViewDelegate <NSObject, UIScrollViewDelegate>

@optional
....

What is the @class for?

Upvotes: 0

Views: 149

Answers (1)

Paul.s
Paul.s

Reputation: 38728

It is a forward declaration.

The very next line in that file is

- (void) gridView: (AQGridView *) gridView willDisplayCell: (AQGridViewCell *) cell forItemAtIndex: (NSUInteger) index;

The @class AQGridView... let's the compiler know that there is a class called AQGridView that will be available at some point (it will be #import'ed when you need to actually use the AQGridView that is passed as an argument).

Upvotes: 2

Related Questions