Documentation Window Tips
Here are a few further useful facts about the Xcode documentation window:
- The Apple Developer Library provides the same guides, references, and sample codes as the documentation library. This library also includes videos, technical Q&A’s, technical notes, and Xcode task overviews.
- The modern documentation window is fully tabbed. To add searches, choose File > New > Tab or press Command-T.
- If you find errors in the Xcode documentation, click the Feedback button at the bottom of the documentation page to provide information to Apple. For example, you might report typos, broken links, incorrect information, poor code samples, incorrect illustrations, or any suggested enhancements. The URL opened by the Feedback button carries information about the page you’re reporting, so you don’t have to worry about describing the location of the issue.
Downloading Documentation Sets
Download document sets (like the ones used by the pop-up window shown earlier in Figure 4) from Xcode preferences. Choose Xcode > Preferences or press Command-, (comma) and then select Downloads. The Downloads tab displays available documentation sets, as shown in Figure 8. Click any item with a circled arrow to start downloading it.
Figure 8 Download sets in the Xcode preferences.
Header Files and Module Declarations
In recent versions of Xcode, documentation struggles to keep up with the enhancements added by new APIs and the inclusion of Swift references. It helps to check header and declaration files to find the most accurate information in a quickly changing development world. Command-click any API item from within the Xcode source editor to jump to its declaration. In Objective-C files, you view the header file. In Swift, you move to the module interface, where public elements are declared.
Standalone headers are also found in the framework folders within Xcode. Navigate into the Xcode application (/Applications/Xcode.app/Contents/) and into the developer folder, down to the included SDKs (Developer/Platforms/iPhoneOS.platform/Developer/SDKs). From there, continue to any SDK and into System/Library/Frameworks. Each public framework offers a Headers subfolder, with a full set of Objective-C header files.
Quick Help and In-Editor References
Choose View > Utilities > Quick Help Inspector to display the Quick Help inspector to the right of the editor pane in the Xcode workspace. Selecting an API reveals the declaration documentation associated with that item (as shown at the top of Figure 9). Alternatively, Option-click the item to view this information as a pop-up (as shown at the bottom of Figure 9).
Figure 9 The Quick Help inspector’s documentation declaration (top) can be displayed as a pop-up (bottom).
Quick Help is not limited to just Apple-defined APIs. Build your own references using doxygen and HeaderDoc markup in Objective-C and reStructuredText in Swift. A simple triple-slash comment (///) adds a Quick Help–ready description to a custom function in either language, as shown in Figure 10. (Thanks, Izzy and Kevin Ballard.)
Figure 10 Custom Quick Help.
Apple does its best to provide accurate and up-to-date documentation to simplify your development work. Make the most of this wealth of information by understanding how best to download, search for, select, and check that documentation, using the tips and tricks shown in this quick write-up.