Why does a simple program import <Foundation/Foundation.h> instead of individual header files?

It doesnt affect the performance as the inbuilt frameworks are all there installed on your device already ready to be linked to by your executable.

What you are saying when you #import <Foundation/Foundation.h> is "I would like access to the functionality of the Foundation framework even if I don't use it all". Its a semantic division.

The compiler will do all the optimisation that needs doing with respect to discarding unused symbols.

The problem with just doing an import on NSString.h is do you know what dependencies there are for NSString. I don't know, and dont need to either.

Tags:

Objective C