Which is the right file to import header files.
In interface, or implementation file ?
I know when is suitable to use @class in interface and import header file in implementation.
Which is the right file to import header files. In interface, or implementation file
Share
It really depends on what you are doing, but generally you want to keep all your imports in the implementation file, however there are times when this is not possible, for example when implementing a protocol you have to import the file there is no way around it, while you can use
@classdirective like you already know for property declarations. The reason for this is so that when that file itself is imported the file that imports it does not import all the other imports that it probably does not need.The exception is of course when you want to create a common header file, for other files to import then you would put all your imports on the header. But then again you could also use the
.pch prefixfile for that.