Code completion is one of the more useful features when you’re developing since it allows you to write code faster. While Code completion should be activated by default in newer versions of Xcode, it’s easy to enable and use if it isn’t. You can also improve the usability of Xcode’s code completion with a great third party plugin, skip to the bottom of the article for that.

Enable code completion in Xcode

* Within Xcode, go to Preferences

* Click on the “Code Sense” icon

* Look for the “Code Completion” section and select ‘Immediate’ from the “Automatically Suggest” drop down menu

* Click “OK”



Using Code completion in Xcode

Once enabled, Xcode will now offer code completion based on what you have typed and offer suggestions for completing the syntax.

* You accept the code suggestion by pressing the Tab key or Return

* You can see a full list of completion suggestions by hitting the Escape key



It’s interesting to note that Apple says Code completion is disabled by default, but in newer versions of Xcode it seems to be enabled by default instead.

Improve Xcode code completion with Auto Assistant plugin

Code completion isn’t perfect in Xcode, but that doesn’t mean there aren’t solutions from third parties. A very helpful Xcode plugin for developers is called Xcode Auto Assistant, and it offers the ability to popup the completion list automatically, all the time, when a character it recognizes is entered. The behavior then becomes closer to how things like Coda, BBedit, Espresso, etc handle code completion. The plugin is a lot more consistent than what Apple offers by default, although I wouldn’t be surprised if this is changed soon with an update to Xcode. Until Apple adjusts the behavior, you can download the plugin from Google Code here.

After you download the Auto Assistant plugin, you’ll need to drop the plugin into the following directory:

~/Library/Application Support/Developer/Shared/Xcode/Plug-ins If /Plug-ins/ does not exist, just create the directory. Relaunch Xcode and the plugin is installed and works immediately.