Please explain your answers as I've gotten away with not having to do this so far.
Thanks
Please explain your answers as I've gotten away with not having to do this so far.
Thanks
Short answer: No. See this question: http://stackoverflow.com/questions/322597/objective-c-class-vs-import/322627#322627
@class is the same as a class forward declaration in C++.
You could simply #import the header file of each view controller, but it's sometimes cleaner to do forward declarations (@class) in the .h file, and only do the #import in your AppDelegate's .m file.
You only import things you need, and @class is doing something similar to #import - it's letting the compiler know a type exists. So why would you tell the app delegate about a class it will never see?
The difference is:
@class
will only say the class exists, nothing more.
#import
tells the code what messages the class accepts or anything else the header file declares. So you use it when the code needs to actually send messages to an object.
That's why a very general pattern is to use @class in the header, and #import in the implementation file. Sometimes you do need to import in the header, again if you have to know anything more than "this class exists".