iphone - #import statements in .m or .h in objective-c? -
i ended having these in both of .h , .m files, first objective-c program i'd clarification can clean thins thing up.
unless affects interface definition should put in .m file.
if use class, use forward declaration:
@class aclass; @interface bob : nsobject { aclass* a; }
if implement something, import it:
#import "someprotocol.h" @interface bob : nsobject<someprotocol> { }
these kinds of thing "best practice" rather absolutely essential. objective c's #import
directive means can't errors because include file multiple times, it's not technically problem, increase compile times.
Comments
Post a Comment