Viewing the interface of your Swift code,查看Swift代碼的標頭檔的三種方法

來源:互聯網
上載者:User

標籤:

?Technical Q&A QA1914Viewing the interface of your Swift codeQ:? 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

Back to Top

第二種方法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

Back to Top

第三種方法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

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?

Viewing the interface of your Swift code,查看Swift代碼的標頭檔的三種方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.