O'Reilly logo

Beginning Mac OS® X Programming by Drew McCormack, Michael Trent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.2. Working with Files

Like the Finder, Xcode allows you to specify how your project files are organized. Unlike the Finder, your changes don't necessarily reflect how the files are stored on disk. Just as it does when creating a project, Xcode automates some of the busy work of creating new source files.

3.2.1.

3.2.1.1. Try It Out: Using Xcode's Groups & Files Viewer
  1. Create a new Standard Tool Command Line Utility project and name it Hello2.

  2. Close the Hello2 project group; then Option-click the disclosure triangle to open it again. The project group and all its subgroups will expand, as shown in Figure 3-4. Notice that the Products file Hello2 is drawn in red; that's because the Hello2 program doesn't exist yet.

    Figure 3.4. Figure 3-4
  3. Click on each of the groups below the Hello2 project group. Notice the contents of the file list changes to match the contents of your selection. When the Hello2 project group is selected, all the files in Hello2 appear in the list; when Source is selected, only main.c appears in the list.

  4. Option-click the Source group. Make sure you click to the right of the disclosure triangle. You can now rename the Source group to My Source Files.

  5. Option-click main.c and rename your source file to Hello2.c.

  6. Click Hello2.1 and drag it into your My SourceFiles group.

  7. Select the Documentation group and press the Delete key. The group is removed from your project. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required