ios - Importing my singleton class using Project_Prefix.pch - Bad practice? -


i use datamanager singleton class in 99% of project. instead of importing in every class thought importing inside pch file constants. there disadvantages this? considered bad practice?

thanks

#import <availability.h>  #ifndef __iphone_5_0 #warning "this project uses features available in ios sdk 5.0 , later." #endif  #ifdef __objc__     #import <uikit/uikit.h>     #import <foundation/foundation.h>     #import "constants.h"     #import "datamanager.h" #endif 

the evaluation practice of #importing xyz.h be, on life of project,

nstimeinterval saved = (time have been spent compiling xyz.h plus every header #imports in each file included every build);  nstimeinterval wasted = (time spent recompiling files not include xyz.h when xyz.h changed);  if (saved > wasted) goodpractice = yes; 

so system #import, , of library #imports, excellent candidates. else; well, if 95% of code recompiled anyway particular header, sure putting in there makes sense. there's writeup here on subject.


Comments