AppCode 2023.1 Help

Populating Projects

You can add files of various formats to your project and organize them in groups. Use available AppCode or Xcode templates to create files with minimum efforts.

If necessary, you can also add empty files, create new file templates and file types.

Create files

AppCode provides file templates for most of the languages that it supports. This lets you create files with the initial content appropriate for the file purpose. For example, there are file templates for Swift types and Objective-C classes, JavaScript files, XSLT style sheets, and so on. Moreover, you can use all default Xcode templates for creating files in AppCode.

Generally, the filename extension for a template-based file is set automatically, so you don't need to specify it. However, if there are several extensions allowed for the file type, you will be able to choose one. For example, when creating a new class, you will be able to choose between .m extension for Objective-C class and .mm extension for Objective-C++ class.

Create a file from an AppCode template

  1. Do one of the following:

    • In the Project tool window Alt+1, select the group in which you want to create a new file, and then choose File | New from the main menu.

    • Right-click the corresponding group and select New from the context menu.

    • Press Alt+Insert.

  2. Select the desired file type from the list.

  3. In the dialog that opens, type the filename (without extension) in the corresponding field.

    Depending on the selected template, the dialog includes various options. For example, for code files, you can select location, group, and targets.

    New file from template

    Specify other information as required. For example, you may be asked to define the values of custom variables if the corresponding file template contains such variables and their values are not currently set.

Create a file from an Xcode template

  1. From the main menu, choose File | New | File from Xcode Template. Alternatively, in the Project tool window Alt+1 right-click a group and select File from Xcode Template.

  2. In the dialog that opens, select a file type on the left pane. On the right pane, choose a template:

    Create file from Xcode template: Step 1

    Click Next to continue.

  3. Specify the filename and location for the new file. You can use the default location selected in the Location field or specify another one. Choose the desired group and target and click Finish.

    Create file from Xcode template: Step 2

Create an empty file

  1. Do one of the following:

    • In the Project tool window Alt+1, select the group in which you want to create a new file, and then choose File | New from the main menu.

    • Right-click the corresponding group and select New from the context menu.

    • Press Alt+Insert.

  2. In the Create New File dialog, type the filename and extension. Optionally, you can change the location of the file on the disk, the group where to add it, and the targets.

    Click OK.

Create groups

A group is an Xcode project model concept. Groups created with AppCode are fully compatible with Xcode.

Groups allow bringing order to the project files and this is their only purpose. You can arrange project items in any way you like. For example, you can organize Model, View, and Controller classes in a separate group or create a group hierarchy for tests.

A group is shown in the Project tool window Alt+1 and on the Navigation bar with the folder icon the Folder icon (if it has an underlying folder) or with the light folder icon the Folder light icon (if there is no underlying folder).

Create a group

  1. In the Project tool window Alt+1, select the destination directory node.

  2. Right-click the selection or press Alt+Insert to invoke the context menu, and then choose New | Group.

  3. In the New Group dialog specify the group name. By default, AppCode creates underlying directory for the group to keep the group and directory structure synchronized. If necessary, you can create a group without this directory. To do so, clear the Create folder checkbox.

  4. Click OK. As soon as the group appears in the Project tool window, you can drag files and groups into it.

Create a group from selection

  1. In the Project tool window Alt+1, select several items (files and/or groups) by clicking them with Ctrl pressed.

  2. Right-click the selection or press Alt+Insert to invoke the context menu, and then choose New | Group from Selection. Note that all selected items should be on the same level of the project hierarchy.

  3. In the New Group dialog, specify the group name and click OK.

Create folder references

As opposed to groups in AppCode, folder references are physical structures. The folder references allow you to organize your files into folders on your file system keeping the same folder structure in AppCode. Therefore, you can manage your asset files from outside of the IDE.

Use that folders as a storage place for project resources that do not need to be compiled (for example, icons). The IDE doesn't consider the source files in such folders as a part of a project.

Create a folder reference

  1. In the Project tool window Alt+1, select the desired group.

  2. Right-click the selection or press Alt+Insert to invoke the context menu, and then choose New | Folder Reference.

  3. In the New Folder Reference dialog, specify the folder name. You can also change the group and target here if required.

  4. Click OK to create the folder reference and respective physical folder.

Last modified: 21 July 2022