Chapter 5. Sources

So far, you've learned how to create and reorganized projects. Everything you've learned so far deals exclusively with the project document. But project documents don't contain anything that generates code or anything else for that matter. To do that, you have to add sources—files that contain actual content—to the project.


Except for the project structure and settings, everything used to build a project comes from source files stored somewhere else.

Program files, headers, folders, libraries, frameworks, window layouts, image files, Info.plist files, help files, documentation, QuickTime movies, you name it—every piece used to build your final product comes from separate files and folders stored somewhere else. They are not stored in the project document.

The information stored in the project document is a reference to those sources. Whenever Xcode needs the content of any source file in your project, it uses its reference to locate and access it. In this chapter, you will learn about the different kinds of references and how to create, organize, and maintain them.


Every file, folder, and framework that you see in the project group of your project window represents a reference to a file or folder in your file system. Each reference consists of two attributes:

  • Path

  • Reference type

The path attribute is a POSIX path, including its name, to the file or folder. The reference type determines from where the path originates. There are five reference types:

  • Absolute ...

Get Beginning Xcode® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.