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

Popular posts from this blog

400 Bad Request on Apache/PHP AddHandler wrapper -

Add email recipient to all new Trac tickets -

php - Change action and image src url's with jQuery -