user89862
user89862

Reputation:

Xcode import a file for every file in project

I have a .h file with global variables, it's tedious to import this file over and over again. Is it possible to tell Xcode to import this always for every file in the project (except for it self I guess..)?

Upvotes: 1

Views: 1254

Answers (1)

Greg
Greg

Reputation: 25459

In xCode project you have a folder named 'Supporting Files' which contains a file:

PROJECTNAME-Prefix.pch

Just add import to those files and this file will be added by compiler to all of your files:

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

The disadvantage of this solution is that if you add lots of files or big files the compiling process will take more time.

Upvotes: 4

Related Questions