Viewing the interface of your Swift code,查看Swift代码的头文件的三种方法
2016-04-12 11:56
411 查看
Technical Q&A QA1914
Viewing the interface of your Swift code
Q: How do I view the interface of my Swift code in Xcode?
问: 怎么在Xcode中查看swift文件的头文件?A: Xcode generates an interface file that includes all your source code's internal and public declarations when using the Assistant editor button, the Navigate menu, or the Generated Interface feature.
第一种方法:Using the Assistant editor button
Select your Swift file in the project navigator.
Click the Assistant editor button in the Xcode toolbar as shown in Figure 1.
Figure 1 Viewing the ListItem file in the project navigator. The numbers in this figure correspond to the steps above.
Xcode automatically shows the generated interface for your Swift code in its Assistant editor pane using the Counterparts mode as shown in Figure 2.
Figure 2 Viewing the interface of ListItem in the Assistant editor pane
Back to Top
第二种方法Using the Navigate menu
Select your Swift file in the project navigator.Choose Navigate > Jump to Generated Interface as shown in Figure 3 to view your code's interface.
Figure 3 Select Jump to Generated Interface to view the interface of ListItem. The numbers in this figure correspond to the steps above.
Note: To jump back to your original Swift code, choose Navigate > Jump to Original Source "<your_filename>.swift" as shown in Figure 4.
Figure 4 Switch back to the Swift file associated with the ListItem interface
Back to Top
第三种方法Using the Generated Interface feature
Select your Swift file in the project navigator.Click the related items button in the editor's jump bar.
Xcode displays a contextual menu. Choose Generated Interface as shown in Figure 5 to view your code's interface.
Figure 5 Select Generated Interface to view the interface of ListItem. The numbers in this figure correspond to the steps above.
Note: To go back to your original Swift code, choose Original Source in the above contextual menu as shown in Figure 6.
Figure 6 Switch back to the Swift file associated with the ListItem interface
Back to Top
Document Revision History
Date | Notes |
---|---|
2016-03-23 | New document that describes how to view the interface of your Swift code. |
Copyright © 2016 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2016-03-23
Feedback
*
*
相关文章推荐
- 自定义滑条封装含有百分比例显示(swift版)
- swift Defer语法
- swift Guard语法
- Swift中声明协议中的class关键字的作用
- Swift中声明协议中的class关键字的作用
- Swift中声明协议中的class关键字的作用
- swift学习日记-可选链(optional chaining)
- swift学习日记-基础部分
- Swift字符串和基本数据类型之间转换
- Swift3.0获取APP版本号,提示用户升级
- Swift Tour
- Swift 定位 SwiftLocationManager
- swift 初步接触 基本语法 方法命名 !和?区别 as!和as?区别 let和var区别 extension override private (一)
- Openstack Swift 原理、架构与 API 介绍
- Swift基础语法(常量变量、数据类型、元组、可选、断言等)
- Swift开源项目汇总
- oc与swift混编教程
- OC 和swift混编网址
- swift.h和briging文件冲突,重复包含
- swift 基础