How does #include differ from #import?
Essence
All three are ways to pull declarations from another file.
#include "a.h"— the C preprocessor directive: textual insertion of the file. If a header lands twice (through a chain of includes) you get a "redefinition" error. Protected manually with include guards (#ifndef A_H / #define A_H / #endif) or#pragma once.#import "a.h"— the Objective-C extension: the same textual insertion, but the preprocessor remembers the file was already included and skips it the second time. No guards needed. The standard for .h/.m.@import Foundation;— modules (Clang modules, since Xcode 5). Not text insertion but attaching a precompiled description of the framework (module map + serialized AST). Benefits: faster compilation (the header is parsed once for all files), autolinking of the framework — no need to add it to Link Binary With Libraries, and the module's macros do not "leak" into your code. With Enable Modules on, a plain#import <Foundation/ Foundation.h>of a system framework is implicitly turned into@import.
#import <Foundation/Foundation.h> // implicitly becomes @import Foundation;
@import UIKit; // explicit module, autolinking
#import "MyModel.h" // own header, duplicate protection
#include <stdlib.h> // plain C
The <...> form searches system paths and frameworks, "..." looks next to the file first.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep