In Objective-C, importing same headers in every class make compile time longer?

前端 未结 5 423
轻奢々
轻奢々 2021-01-11 17:23

I\'m a beginner of Objective-C/iOS programing.

I want make a one header file which includes all class headers I use in my project.
And import the header in every

5条回答
  •  花落未央
    2021-01-11 17:54

    If you want headers imported globally you should do so in the YourProject-Prefix.pch file. It should look something like this..

    #import 
    
    #ifndef __IPHONE_4_0
    #warning "This project uses features only available in iOS SDK 4.0 and later."
    #endif
    
       #ifdef __OBJC__
       #import 
       #import 
       #import "YourGlobalHeader.h"
    #endif
    

    Now, All of your classes have YourGlobalHeader.h automagically imported.

提交回复
热议问题