It is to my understanding that one should use a forward-class declaration in the event ClassA needs to include a ClassB header, and ClassB needs to include a ClassA header to avoid any circular inclusions. I also understand that an
#import is a simple
ifndef so that an include only happens once.
My inquiry is this: When does one use
#import and when does one use
@class? Sometimes if I use a
@class declaration, I see a common compiler warning such as the following:
warning: receiver 'FooController' is a forward class and corresponding @interface may not exist.
Would really love to understand this, versus just removing the
@class forward-declaration and throwing an
#import in to silence the warnings the compiler is giving me.