Search code examples
iosobjective-ccompilationpch

Does #import <UIKit/UIKit.h> on pch slow down the compile time?


I was reading this post about imports and I had one question. Does the #import that comes in the prefix.pch file by default slow down the compile time? Should I remove it and import only when necessary?

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif

Solution

  • No. It actually improves the compilation speed.

    This is a nice tutorial that actually clears all the confusion over use of #import statements and .PCH files. Also it tells you in detail about something new known as "modules", introduced in iOS7.