When you write code with Xcode you have a set of “workbench” tools at your disposal. A few of these tools are described next.
Project Find
Code Sense and Code Completion
Integrated Documentation Viewing
Indentation
Delimiter Checking
Emacs Bindings
Project Find (available from the Find window in Xcode) allows you to search both your project’s code and the system headers for identifiers. Project Find uses a project index that stores all of a project’s identifiers (classes, methods, globals, and so forth) on disk.
For C-based languages, Xcode automatically gathers indexing information while the source files are being compiled; therefore, it is not necessary to build the project to create the index before you can use Project Find.
Code Sense indexes your project files to provide quick access to the symbols in your code and the frameworks linked by your project. Code Completion uses this indexing to automatically suggest matching symbols as you type. These features can be turned on in the Code Sense preferences pane in the Xcode Preferences window.
Since Code Sense and Code Completion use Xcode’s speedy indexing system, the suggestions they provide appear instantaneously as you type. If you see an ellipsis (...) following your cursor, Xcode could not find an exact match.
Xcode supports viewing HTML-based ADC Reference Library content directly in the application. You can access reference material about the Xcode application, other developer tools, Carbon, Cocoa, AppleScript Studio, and even access UNIX man pages.
Additionally, you can jump directly from fully or partially completed identifiers in your code to reference information and header files. To retrieve the reference information for an identifier, Option–double-click it; to retrieve its declaration in a header file, Command–double-click it.
The search bar in the Developer Documentation window also offers you a quick and easy way to find an identifier in any of Cocoa’s programming interfaces.
In the Indentation preferences pane in the Xcode Preferences window you can set the characters at which indentation automatically occurs, the number of spaces per indentation, and other global indentation characteristics. The Format menu also offers commands to indent code blocks individually.
Double-click a brace (left or right, it doesn’t matter) to locate the matching brace; the code between the braces is highlighted. In a similar fashion, double-click a square bracket in a message expression to locate the matching bracket, and double-click a parenthesis character to highlight the code enclosed by the parentheses. If there is no matching delimiter, Xcode emits a beep.
You can use the most common Emacs commands in the Xcode code editor. (Emacs is a popular editor for writing code.) For example, there are the commands page-forward (Control-v), word-forward (Meta-f), delete-word (Meta-d), kill-forward (Control-k), and yank from kill ring (Control-y).
Some Emacs commands may conflict with some of the standard Macintosh key bindings. You can modify the key bindings the code editor uses in the Key Bindings preferences pane in Xcode Preferences to substitute other “command” keys—such as the Option key or Shift-Control—for Emacs Control or Meta keys. For information on key bindings, see About Key Bindings in Text Input Management.
Last updated: 2007-10-31