Is there a way to "promise that a class exists elsewhere" (i.e. similar to the extern keyword) and therefore avoid having to use #import
statements?
Here is an example of what I am trying to do:
extern @class MyClass;
@interface Foo : NSObject
@property (nonatomic) MyClass *abc;
@end
Where MyClass
definitely exists and is used throughout my program, but at the time I create this file, I don't know the name of the file where MyClass
is defined.
Update: It seems like the error is related to the fact that this is a category. Updated code follows:
@class MyClass;
@interface MyClass (Extensions)
- (void)foo;
@end
Gives the following error:
Cannot define category for undefined class 'MyClass'.