0% found this document useful (0 votes)
39 views

03 - Manage Files and Navigate Symbols

The project navigator can be used to locate and manage items in a project. It allows you to open, add, delete, and organize files. You can search for files, show recently modified files, and add files to your project from templates or from your computer. The symbol navigator browses symbols across project files like classes, functions, and variables. Files and symbols can also be navigated using the jump bar. The documentation window provides searchable references, guides and sample code to help with development.

Uploaded by

Dada Sdfbfgjhghj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

03 - Manage Files and Navigate Symbols

The project navigator can be used to locate and manage items in a project. It allows you to open, add, delete, and organize files. You can search for files, show recently modified files, and add files to your project from templates or from your computer. The symbol navigator browses symbols across project files like classes, functions, and variables. Files and symbols can also be navigated using the jump bar. The documentation window provides searchable references, guides and sample code to help with development.

Uploaded by

Dada Sdfbfgjhghj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Locate and manage items in a project or

workspace
Use the project navigator to open, add, delete, and organize files in your project. To switch to the project navigator,
click the Project Navigator button (
the content area below.

) in the navigator bar of the navigator area. Your project files are displayed in

Open a file: Click the file to open it in the editor area.


Search for a file: Enter text in the filter field.
Show recently modified files: Click the Recent Files icon in the filter field.
Show files with source control status: Click the Source Control icon in the filter field.
Add a new file: Click the Add button (+) at the bottom, choose File, and select a template.
Add an existing file: Click the Add button (+) at the bottom, choose Add Files to [ProjectName], and choose a file
on your computer.
Add a new group: Click where you want to add the group and choose File > New > Group.
Add files to a new group: Select the files and choose File > New > Group from Selection.
Add files to an existing group: Select the files and drag them to the group.

Add files and folders to a project


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.

Add a new file from a template


1. 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.
2. Click the Add button (+) in the filter bar and choose File from the pop-up menu (or choose File > New > File).
3. 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.
4. Select a template for the file type, and click Next.
5. In the sheets that follow, enter any required information and click Next.
For example, enter a class name for a class implementation file.
6. In the last sheet, choose a location and enter a filename (if applicable).
7. Choose a group from the Group pop-up menu.
The project structure is different from the file system structure.
8. Select the targets that you want to add the file to.
9. Click Create.
The new file is selected in the project navigator and opens in the appropriate editor.

Add existing files and folders from your computer


1. In the project navigator (

), select the destination project or group for the item you want to add.

2. 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.
3. 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.

4. Optionally, click New Folder to add a folder for your files.


5. Click Add.
Tip: You can also drag the files from the Finder to a location in the project navigator to add them.

Delete files and folders


1. In the project navigator (

), select the files and folders.

2. Choose Edit > Delete.


3. 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.

Navigate the classes, functions, and other symbols in your project


Use the symbol navigator to browse the symbols available across all files in your project, including classes,
protocols, properties, functions, structs, unions, enums, types, variables, and globals. Select one to display it in an
editor area pane.

Show only classes and protocols: Click the Classes and Protocols button (
Show only project symbols: Click the Project Symbols button (

) in the filter bar at the bottom.

) in the filter bar at the bottom.

Show only containers, such as classes and functions: Click the Containers button (
bottom.

) in the filter bar at the

Show the inheritance hierarchy of classes and protocols: Click Hierarchical at the top.
Show a flat list of classes and functions: Click Flat at the top.
Tip: You can navigate the symbols in the current file using the jump bar at the top of an editor area pane.

Navigate to files and symbols using the jump bar


The jump bar is an interactive, hierarchical mechanism for quickly navigating to files and other items, such as
properties and methods in your source code. The jump bar appears at the top of each editor area pane, such as
while editing source code or an interface in the standard editor or assistant editor.

Show a recently viewed file: Click the Related Items icon (


pop-up menu.

) and choose Recent Files > [Filename] from the

Clear the list of recently viewed files: Click the Related Items icon (
from the pop-up menu.

) and choose Recent Files > Clear Menu

Increase or decrease the number of recently viewed files displayed: Click the Related Items icon (
choose Recent Files > Number of Recent Files > [Number] from the pop-up menu.

) and

Show a counterpart file, such as the interface file for an implementation file: Click the Related Items icon (
and choose Counterparts > [Filename] from the pop-up menu.
Show a file related to the current context: Click the Related Items icon (
menu.

) and choose a file from the pop-up

Step forward or backward through your viewing history: Click the Previous button ( ) or Next button ( ) on the
left side of the bar. Click and hold a button to display a pop-up menu containing the complete viewing history.
Choose an item to jump to it.
Navigate to a file: Click a hierarchical path segment to display a pop-up menu of files at that level of the hierarchy.
Choose a file to jump to it.
Navigate to a symbol: Click the final path segment to display a pop-up menu of symbols, such as properties and
methods, in the current file. Choose a symbol to jump to it. Hold down the Option key when clicking this segment to
sort the pop-up menu items alphabetically.
Step through issues: Click the Previous button ( ) or Next button ( ) on the right side of the bar. Click the icon
between the buttons to display the current issue. These buttons are only visible when there are problems.
Tip: The View > Standard Editor menu includes menu items for showing related items, previous files history, next
files history, top level items, group files, and document items in the jump bar. Use the keyboard shortcuts for these
menu items to navigate through your project using the keyboard.

Search for developer documentation


Use the documentation window to find SDK reference, guides, and sample code. To open the documentation
window, choose Window > Documentation and API Reference.

Search for reference, guides, and sample code


1. In the toolbar, enter a search string in the search field.
As you type, the results appear in a sheet below the search field.

2. In the sheet, filter the results by choosing a programming language.


3. To select the top result, press Return in the search field.
4. To select another search result, select it in the sheet.
5. To view the results in the window, select Show All Results at the bottom of the sheet.

Results appear in four categories: API Reference, SDK Guides, Tools Guides, and Sample Code. Within each
category, results are sorted by relevance.

Show or hide the table of contents

In the toolbar, click the Table of Contents button to the left of the search field.

Show or hide the documentation navigator

In the toolbar, click the documentation Navigator button to the left of the Table of Contents button.

Browse documentation
1. Show the documentation navigator.
2. To browse API reference, in the navigator bar, click the framework icon.

3. To browse Guides and Sample Code, click the document icon.


4. To browse bookmarks, click the bookmark icon.

Go forward and backward

In the toolbar, click the right and left arrows.

Share documentation links

In the toolbar, click the Share button in the upper-right corner and choose a method from the pop-up menu.

Create bookmarks
1. Open the book or section you want to bookmark.
2. Next to the document title, click the bookmark icon. (Alternatively, in the toolbar, click the Share button and
choose Add Bookmark from the pop-up menu.)
The bookmark appears in the bookmark navigator.

Create a documentation tab

Choose File > New > Tab (or click the Add button (+) in the tab bar).
The current document appears in the tab bar. (To display the tab bar, choose View > Show Tab Bar.)

Rename a project or an app


Use the File inspector to give a project or an app a new name.
1. Select your project in the project navigator.
2. In the Identity and Type section of the File inspector, enter a new name into the Name field.

3. Press Return.
A dialog is displayed, listing the items in your project that can be renamed. The dialog includes a preview of how
the items will appear after the change.

4. To selectively rename items, disable the checkboxes for any items you dont want to rename. To rename only your
app, leave the app selected and deselect all other items.
5. Click Rename.

Edit property lists


Click a property list in the project navigator to inspect or edit its keys and values in the property list editor.

Add a property
1. Click the Add button (+) beside a key in the property list editor or select an existing property and press Return.
2. Choose a key from the pop-up menu (press the Down Arrow key to display it if its not visible) or type a new key
name in the Key column.
3. Choose a type from the pop-up menu in the Type column.
4. Enter a value in the Value column.
To add a value to an array or dictionary, expand the disclosure triangle beside the array or dictionary. Next, click
the Add button (+) or press Return to add a child property.

Remove a property

Click the Remove button () beside a key in the property list editor or select a property and press Delete.

See raw property key names

Control-click anywhere in the property list editor and choose Show Raw Keys/Values from the contextual menu.
Repeat the process to hide the raw keys and show the readable ones again.

See the source code of a property list

Control-click a property list in the project navigator and choose Open As > Source Code from the contextual
menu. Repeat the process but choose Open As > Property List to display it as a property list again.

Change the property list type


The property list editor supports many different types of property list files, each of which defines a specific set of
possible keys. If Xcode cant determine the type of a property list, you may need to specify its type manually.

Control-click anywhere in the property list editor and choose Property List Type > [Type] from the contextual
menu.
The current type is indicated by a preceding dash.

You might also like