• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Viewing the interface of your Swift code,查看Swift代码的头文件的三种方法 ...

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
 
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

  1. Select your Swift file in the project navigator.

  2. 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

第二种方法Using the Navigate menu

  1. Select your Swift file in the project navigator.

  2. 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

第三种方法Using the Generated Interface feature

  1. Select your Swift file in the project navigator.

  2. Click the related items button in the editor\'s jump bar.

  3. 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

 


Document Revision History

 

DateNotes
2016-03-23

New document that describes how to view the interface of your Swift code.

 

 

 
Feedback

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
给swift程序猿留下深刻印象的10个Swift代码发布时间:2022-07-13
下一篇:
swift3.0系列完整demo代码库发布时间:2022-07-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap