Learn How to Use Documentation

Learning Objectives

After completing this unit, you'll be able to:

  • Navigate the documentation browser.
  • Find sample code and framework guides.

Most developers have a preferred method of accessing documentation. Some developers prefer to review documentation in a browser, while others like to download it to their desktops. By learning multiple ways to interact with documentation, you can decide which method works best for you. The faster you can find answers to your questions, the faster you can get back to writing code.

Documentation Browser

In the previous unit, you added lines of code inside the viewDidLoad() function. Do you have an idea of what that function does or when the function is called in your program? Xcode provides a fast answer using the Quick Help feature. Option-click the viewDidLoad() method name, and Xcode displays a brief description of the function.

The documentation popup shows a Summary of a function, the Declaration, and context in Discussion.

Within the Quick Help information, click Open in Developer Documentation to access Xcode documentation, which includes more thorough explanations and references to related functions. (You can also access this window from the Xcode Help menu or by using the keyboard shortcut Command-Shift-0.) Use the links on the right side of the documentation to go to different information within the same page.

viewDidLoad Documentation in its own window with more details, including Related Documentation.

At the top of the documentation window, notice a search field, where you can look for documentation about any function, class, or framework. Use this feature to quickly search through thousands of pages of documentation. Answers are readily available, which is why many developers choose to keep open the documentation window while they're coding.

Try navigating through the Xcode documentation. In the search field, enter: UIViewController. As you type, Xcode suggests matching options with autocompletion. As soon as you see UIViewController in the menu, select UIViewController to display its documentation.

In the top-right corner, under On This Page, click the Topics link to go down the page. The Topics section displays a list of symbols that are grouped by topic. A symbol is a function or variable associated with a particular class. In the documentation, these symbols are sorted into logical categories rather than in alphabetical order, so you can more easily locate items that interest you.

Documentation topics including Creating a View Controller and Interacting with Storyboards.

When building a new feature, these logical categories can help you more easily determine if an object provides the capabilities your feature requires.

Look at the topics for UIViewController, and find the symbol for the view property. Click this symbol.

Documentation about the view property.

Notice the information for your selected property. Most instance property documentation follows a similar pattern:

  • A short description:A quick summary of the property.
  • Declaration:The name used to access the property and the property's associated type.
  • Discussion:An in-depth description of the important details to consider when using the property.
  • See Also:Other symbols that are related to the property that may be of interest.

In the upper-left corner, notice two buttons with arrows: Left-facing and right-facing arrows for page navigation. Use these buttons to navigate backward Left-facing arrow button and forward Right-facing arrow button through your viewing history. Click the back (left-facing) arrow button to return to the documentation for UIViewController. Find the symbol for the function viewWillAppear(_:).

Documentation for the viewWillAppear(_:) method.

Most method documentation will follow a very similar pattern to instance property documentation with one possible addition: parameters. If the function has any parameters, or inputs, these are listed with the name that you use to access the parameter, along with a short description of that parameter.

Sample Code and Guides

Technical documentation might not be the ideal learning resource for some programmers or in certain situations. As you advance through coding concepts, seeing these concepts in action might be useful. Apple provides numerous guides and sample code projects to illustrate how to use frameworks and their functions. Visit the Apple Developer Documentation Archive, where you can view or download these guides and sample code projects.

You need to learn how to read and decipher documentation to be a successful developer. Because documentation can be technical, these resources can be difficult to understand when you first read them. Using documentation effectively takes practice.

This module provides links to Apple Developer Documentation in the Related Resources section. Read through these resources. You may not understand every sentence or concept during your initial reading, but you'll strengthen a useful skill.

Lab: Use Documentation


The objective of this lab is to use Xcode documentation to learn about iOS frameworks. You'll navigate through documentation and Quick Help to answer questions about the UIView class and about a method provided in an Xcode project.

Part 1: Create a Pages document for your answers

  1. Create a new Pages document called: Lab - Use Documentation.
  2. Save this document to your project folder.
  3. Use this document to record your answers to the questions in the rest of this lab.

Part 2: Use documentation to learn about the UIView class

  • What are three primary responsibilities of a UIView object?
  • How does documentation refer to a view that's embedded in another view?
  • How does documentation refer to the parent view that is embedding the other view?
  • What is a view's frame?
  • How is a view's bounds property different from its frame property?

Be sure to save your Pages document to your project folder.