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

 
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

转载于:https://www.cnblogs.com/xilifeng/p/5382115.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值