Entering Text with Code Completion

Finish entering a symbol by accepting an Xcode suggestion for completion. The proposed symbol is based on the text you have typed so far and the surrounding context. Continue typing to refine the list of choices.

To enter text using code completion
  1. Begin typing the name of a symbol.

  2. Click an item in the suggestion list.

  3. Press Return to accept the suggestion.


If all of the possible completions have a common prefix, the prefix is indicated with a dotted underline. Press the Tab key to accept only the prefix, or press Return to accept the entire suggestion. If there is no common prefix, code completion shows the dotted underline up to the next uppercase letter in the symbol.

Press Control–Space bar to toggle the completion suggestion on or off. That is, if the inline suggestion and list are being displayed, pressing Control–Space bar cancels the code completion operation. (Pressing the Esc key or clicking elsewhere in the text also cancels the operation.) If there is no suggestion displayed, place the insertion point at the end of a partially-typed symbol and press Control–Space bar to get completion suggestions.

To turn off the code completion feature, choose Xcode > Preferences and click Text Editing. In the Editing pane, deselect the option “Suggest completions while typing.” You can always invoke code completion by pressing Control–Space bar.

A Quick Help pop-up window is available from code completion. Hold the pointer over the code completion option you’re interested in until a question mark icon appears. Click the question mark to open Quick Help. As before, press the Tab key to accept the prefix or Return to accept the entire suggestion. Click the Done button in the Quick Help window to close the window.

When a method or function contains parameters or arguments, code completion includes a placeholder for each. Choose the Jump to Next Placeholder (Control-/) and Jump to Previous Placeholder (Control-Shift-?) items in the Navigate menu to move from one placeholder to another.