Xcode provides templates for the common types of files you may want to add to your project, such as Playgrounds and Swift files. You can also add copies of, or references to, existing files and folders on your computer.
In the Project navigator (), select the location where you want to add the file.
Tip: You can also drag a file type from the File Template library to a location in the Project navigator.
Click the Add button (+) in the filter bar and choose File from the pop-up menu (or choose File > New > File).
Click iOS, watchOS, tvOS, or macOS at the top of the template dialog to display the templates for that platform.
Templates are organized into the following groups:
Source: Source code files for different programming languages and Swift playgrounds.
User interface: User interface files for storyboards, views, and launch screens.
Core Data: Files needed to use the Core Data framework. (Core Data provides local storage for objects.)
Apple Watch: Files specific to WatchKit development such as a WatchKit storyboard.
Resource: Resource files such as GPX, settings bundle, property list, rich text, and strings files.
Other: Miscellaneous files such as empty files, assembly-language and shell script files, and configuration files.
Select a template for the file type, and click Next.
In the sheets that follow, enter any required information and click Next.
For example, enter a class name for a class implementation file.
In the last sheet, choose a location and enter a filename (if applicable).
Choose a group from the Group pop-up menu.
The project structure is different from the file system structure.
Select the targets that you want to add the file to.
Click Create.
The new file is selected in the Project navigator and opens in the appropriate editor.
In the Project navigator (), select the destination project or group for the item you want to add.
Click the Add button (+) in the filter bar, choose Add Files to “[Project Name]” from the pop-up menu (or choose File > Add Files to “[Project Name]”), and select the files or folders.
At the bottom of the sheet, click Options.
Choose options for how the files and folders are added:
Copy the files and folders into the project: Select “Copy items if needed.”
Select this option if you want the files and folders to reside in the project folder.
Create groups for each folder: Select “Create groups.”
Select this option if you want the group structure to be the same as the file structure.
Create references for each folder: Select “Create folder references.”
Select this option if you want the folders and their contents to appear in the Project navigator, but not actually reside within the project. A folder reference is a reference in the Project navigator to a folder in the file system.
Add the files to the project or selected targets only: Select the targets that you want to add the file to.
Optionally, click New Folder to add a folder for your files.
Click Add.
Tip: You can also drag the files from the Finder to a location in the Project navigator to add them.
In the Project navigator (), select the files and folders.
Choose Edit > Delete.
In the dialog that appears, choose a delete option.
Remove the files and folders from the project and the file system: Click Move to Trash.
Remove the files and folder references from the project only: Click Remove References.