It's a new feature called Modules or "semantic import". There's more info in the WWDC
2013
 Session 205 & 404 videos. It's kind of a better implementation of the pre-compiled headers. You can use modules with any of the system frameworks in iOS 7 and Mavericks. They are a packaging together of the framework executable and it's headers and
are touted as being safer and more efficient than#import.

One of the big advantages of using @import is
that you don't have to add the framework you want in the project settings, it's done automatically. That means that you can skip the step where you click the plus button and search for the framework (golden toolbox), then move it to the "Frameworks" group.
It will save many developers from the cryptic "Linker error" messages.

Also, you don't actually need to use the @import keyword.
If you opt-in to using modules, all#import and #include directives
are mapped to use @import automatically.
That means that you don't have to change your source code (or the source code of libraries that you download from elsewhere). Supposedly using modules improves the build performance too, especially if you haven't been using PCHs well or if your project has
many small source files.

Modules are enabled by default in new projects in Xcode 5. To enable them in an older project, go into your project build settings, search for "Modules" and set "Enable Modules" to "YES". The "Link Frameworks" should be "YES" too:

You have to be using Xcode 5 and the iOS 7 or Mavericks SDK, but you can still release for older OSs (say iOS 4.3 or whatever). Modules don't change how your code is built or any of the source code. You can't use them for your own frameworks.

From the WWDC slides:

  • Imports complete semantic description of a framework
  • Doesn't need to parse the headers
  • Better way to import a framework’s interface
  • Loads binary representation
  • More flexible than precompiled headers
  • Immune to effects of local macro definitions (e.g. #define
    readonly 0x01
    )
  • Enabled for new projects by default

To explicitly use modules:

Replace #import
<Cocoa/Cocoa.h>
 with @import
Cocoa;

You can also import just one header with this notation:

@import iAd.ADBannerView;

The submodules autocomplete for you in Xcode.

@import vs #import - iOS 7的更多相关文章

  1. package、import和import static

    package 语句: 该语句必须作为源文件的第一条非注释性语句,一个源文件只能指定一个包,即只能包含一条package语句. import 和import static 关键字: 引入import关 ...

  2. #import、#include、#import<>和#import””的区别

    一.#import与#include #import不会引起交叉编译的问题.因为在Objective-C中会存在C/C++和Object-C混编的问题,如果用#include引入头文件,会导致交叉编译 ...

  3. 模块的语法 import ,from...import....

    ------------------------积极的人在每一次忧患中都看到一个机会, 而消极的人则在每个机会都看到某种忧患 1. 认识模块 模块可以认为是一个py文件. 模块实际上是我们的py文件运 ...

  4. import()、import语句、require() 区别

    import命令能够接受什么参数,import()函数就能接受什么参数,两者区别主要是后者为动态加载. import() 与 import语句 区别 区别项 import() import语句 参数都 ...

  5. python3 from Tkinter import * 和import Tkinter as tk两个区别import Tkinter

    原文https://stackoverflow.com/questions/15974787/difference-between-import-tkinter-as-tk-and-from-tkin ...

  6. from module import 和 import 的区别

    最近在用codecademy学python,遇到一些题目错误,小小记录一下 如from math import sqrt是把sqrt作为本文件的方法导入进来了,使用的时候只需要直接调用sqrt. 而如 ...

  7. OC导入框架方式#import、@import的区别

    #import负责导入程序所需的文件的信息导入到程序中,随着程序所需的文件越来越多,程序就要导入更多的文件,这就带来了越来越长的编译时间,而且有大量重复的.为了解决这个问题可以采用以下办法解决,创建. ...

  8. python from import与import as 的含义

    from os import makedirs, unlink, sep #从os包中引入 makedirs.unlink,sep类 from os.path import dirname, exis ...

  9. 2019-7-16 import / from...import... 模块的调用

    模块调用的总结:如果你是pycharm打开文件,会自动帮你把文件根目录加到system.path中,你要调用模块直接以根目录为基准开始找.1.假如你要调用和文件根目录为同级的文件,你直接import ...

  10. Python进阶(八)----模块,import , from import 和 `__name__`的使用

    Python进阶(八)----模块,import , from import 和 __name__的使用 一丶模块的初识 #### 什么是模块: # 模块就是一个py文件(这个模块存放很多相似的功能, ...

随机推荐

  1. C++ Builder 2007中应用数据库SQLite(转载)

    第一次使用SQLite数据库,而且BCB2007也不熟,这两者的结合那就更让我难受了.今天只是简单的在BCB中调用SQLite,就花了我一下午时间,这也足见本人知识的浅薄,另一方面也说明我对这二者确实 ...

  2. dijkstra (模板)

    突然意识到以前写的都是假的dij,感谢GhostCai神犇. #include<iostream> #include<cstdio> #include<cstring&g ...

  3. Lucene 全文搜索解析

    一.创建查询对象的方式 对要搜索的信息创建 Query 查询对象,Lucene 会根据 Query 查询对象生成最终的查询语法.类似关系数据库 Sql 语法一样,Lucene 也有自己的查询语法,比如 ...

  4. PHP面向对象魔术方法之__get 和 __set函数

    l 基本的介绍 (1) 当我们去使用不可以访问的属性时,系统就会调用__get方法. (2) 不可以访问的属性指的是(1 . 该属性不存在 2. 直接访问了protected或者private属性) ...

  5. 报错initscripts conflicts with redhat-release-server-7.0-1.el7.x86_64

    报错 解决:删除冲突的rpm包即可 rpm -e redhat-release-server-7.0-1.el7.x86_64 --nodeps

  6. Java学习之一(引用相关)

    1.Java概述 首先,Java是一门面向对象的编程语言.相对于C/C++等语言,Java中没有指针,但是这不代表指针等知识不重要:Java中不存在多继承但是存在多接口.在我自己的学习过程之中,我偏向 ...

  7. ES6之主要知识点(二) 变量的解构赋值。默认值

    引自http://es6.ruanyifeng.com/#docs/destructuring 数组解构赋值 默认值 对象解构赋值 用途 1.数组的解构赋值 let [a, b, c] = [1, 2 ...

  8. 编程之法:面试和算法心得(旋转字符串java实现)

    内容全部来自编程之法:面试和算法心得一书,实现是自己写的使用的是java 题目描述 给定一个字符串,要求把字符串前面的若干个字符移动到字符串的尾部,如把字符串“abcdef”前面的2个字符'a'和'b ...

  9. 2019-8-31-C#-已知点和向量,求距离的点

    title author date CreateTime categories C# 已知点和向量,求距离的点 lindexi 2019-08-31 16:55:58 +0800 2018-05-08 ...

  10. linux服务器之间传输文件

    转载:https://www.jb51.net/article/82608.htm 1. scp(最近就使用了scp) [优点]简单方便,安全可靠:支持限速参数 [缺点]不支持排除目录[用法]scp就 ...