I am well aware that the general rule is that you should import only the necessary base class interfaces, protocol interfaces, etc. - to compile and use the @class class for everything, declared. However, I came across the following scenario, in which it seemed to me that #import was a more suitable solution:
First, I just scroll forward ClassA and ClassB (since the components of classCObjects have ClassC only by contract). That was my initial instinct.
But after trying to use ClassD elsewhere, I quickly realized that I also had to import ClassA , ClassB and ClassC along with ClassD wherever I used it. When using ClassD doesn't seem to need to worry about another class. I thought that basically the user of ClassD should really only care about importing ClassD.h and assume that he can work with the whole class without many other #import statements. Given the above approach, I have included in my interface everything I need to work in the ClassD domain.
Is there a good reason why this approach is not perfect, except that "you included more than is absolutely necessary for compilation?"
LucasTizma
source share