Start developing IOS Apps Follow-up to the Today series
13. Find information
When you develop your application, you'll want information that you've previously known or didn't know to be readily available. Without having to leave Xcode, you can get all the information you need.
Xcode comes with a number of different types of documents, including common guidelines and concept guides, frameworks and class references, and focused help articles. There are a variety of ways to access this type of document, such as holding right-click each area of Xcode to see how it works, opening the Quick help panel in the main Project window to get context-sensitive code assistance, or searching in the documentation window to find guidance and complete API Reference.
Get Xcode guidance with contextual help articles
To get help when using Xcode, read the Help article. The Help article explains how to accomplish common tasks, such as creating a new class, setting a custom class in Interface Builder, and using Auto Layout to solve the problem.
Depending on what you're trying to do, you can Control-click a UI element in Xcode to access some help articles. Finds what was last entered in the context menu ("Project Navigator help" in this image).
If you are looking for generic help, or if a task-related element does not support the Control-by-click to access the information, you can also search for associated help in the Xcode helps menu.
Use the Guide to get a general overview and conceptual overview
Read the relevant chapters in the concept guide to learn about new technologies or in-depth understanding of how the different classes in the framework work together. Most COCOA frameworks and technologies have corresponding programming guidelines, such as theSpriteKit ProgrammingGuide (Sprite Kit programming Guidelines), the programming withObjective-c (using OBJECTIVE-C programming), as well as the location and mapsProgrammingGuide (placement and map programming guidelines).
In Xcode, you can use the Document display window to view such a document by choosing Help > Documentation and API Reference (option–command– question mark). Just type the technical name, such as "Sprite Kit".
The results are displayed in an orderly fashion, and the most helpful content for your code is in the forefront. This means that the API reference entries will be listed first, followed by the SDK and the "Tools" guide.
If the pop-up list does not display the appropriate results, choose Show All Results to display the full results that are available for filtering.
Use API reference to get class information
Once you have read the guide, learned about all aspects of the technology, and started to write code using the technology, you will find that you need to know more about what each class can do, or how to call a particular method correctly. This information is provided in the API reference document.
For example, to learn more about the NSString class used in the previous tutorials, simply type the name of the class in the search bar of the document display window.
The most commonly selected content is usually the desired content, press the Return key to select, and then you can see the API reference for that class.
The API reference gives you quick access to information about each class, including the list of methods provided by the class, the parent class, and the protocols used. Click More related items to view general information about the class.
The related Items pop-up window also displays a list of related guides. For example, for nsstring, if you prefer to understand the conceptual overview rather than delve into the resources, read thestring ProgrammingGuide.
In addition to describing specific methods or properties, the API reference also outlines all the tasks that a class can perform.
Use Quick help to get the associated source code information
When you write code in the source editor, you can easily access the API reference in the Quick Help panel (choose View > Utilities > Show Quick help Inspector). TheQuickhelp panel is constantly updated as you write your code, displaying information about the symbols you are currently typing.
In addition, you can hold down the Option key in the source editor to display a pop-up window with quick help information by clicking the symbol.
With the Quick help panel or pop-up window, you can open the API reference in a separate document display window, and you can view the original header file that contains the declaration of the symbol you click.
Use the sample code to see the actual usage
In addition to written documents, you can also access the sample code repository. Whenever you read quick Help or guides and references in the Document display window, there are entries that show relevant sample code artifacts for a given technology or class.
Tap any of the sample code entries to download and open the project in Xcode so that you can examine the code.
In addition to code comments throughout the project, some of the larger code examples have additional documents. For example, the Sprite Kit Adventure project attached thecode:explained Adventure(code: Explain adventure) document.
Start developing IOS Apps Today series (13)