cfischer
cfischer

Reputation: 24912

Cocoa frameworks that don't need to be #imported

I noticed that after adding certain frameworks to a project in Xcode, you don't have to import any of its header files in order to access its classes. How come those classes are "magically" available without the import?

Upvotes: 3

Views: 78

Answers (1)

Sergey Grishchev
Sergey Grishchev

Reputation: 12051

Look for yourProjectName-Prefix.pch file. There you'll find:

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

Inside the #ifdef statement you can add any files you like that will automatically imported throughout you whole project.

Upvotes: 6

Related Questions