14 Essential Xcode Tips, Tricks and Resources for iPhone Devs
Xcode is big. Apple’s Xcode Workspace Guide, a terse inventory of its features, is 116 pages. Xcode’s preference window has 13 sections, each with a dozen or more items. There are at least 206 keyboard shortcuts. I started counting menu items but gave up the ghost when I’d topped 300 items before finishing the third section.
Cutting Through The Clutter
We’ve collected a set of tips, resources, how-tos, tutorials and links ranging from newbie-to-expert to help you wring the maximum amount of productivity out of Xcode:
[Note: Apple changed their link-structure, so all of the links to Apple’s documentation are now broken. Anyone know of a “permalink” like approach to pointing to Apple documentation so I can fix this once and not have to redo again and again? Email firstname.lastname@example.org]
All-in-One Window Layout from Apple’s Xcode Workspace Guide – For many, Xcode’s default layout feels like a sea of windows. Xcode’s All-in-one layout, accessible under Preferences… > General, “provides a single project window in which you can perform all the tasks necessary for software development.” A Condensed layout style is also available.
Split Editor from Apple’s Xcode Workspace Guide – Miss multi-panel editing from your last editor? I’m looking at you, vim and emacs. Split the editor horizontally by clicking the button (located on the top-right of the editor pane) or with the keyboard shortcut command-”. Split the editor vertically with by prefixing the preceding with the Option key. Close either with .
Cocoa Programming for Mac OS X by Aaron Hillegass (Profile) suggests turning on Syntax-aware indenting under Preferences… > Indenting and always showing the console when running an app under Preferences… > Debugging > On Start: Show Console.
Keyboard and Mouse Shortcuts
The Xcode Tips & Tricks thread on Stack Overflow features, among other things, these Essential Keyboard and Mouse Shortcuts:
- Option-Command-Up: toggle betweeen .m and .h files
- Code completion: press tab to accept the current suggestion
- Command-double-click: jump to the .h definition of the symbol under the mouse
- Option-double-click: open the documentation for the symbol under the mouse
- Command-shift-D: open file quickly (similar to Command-t in TextMate)
Jeff Nouwen (Profile) reported, “After discovering ??E [which hides the details panel above the editor panel] and remembering ^1 [which brings up a quick jump to recent files], the All-In-One layout in Xcode is starting to really grow on me. Viva keyboard shortcuts!”
55 C and ObjC Text Macros with Completion Prefixes from Apple’s Xcode Workspace Guide – Type the letter-a then escape and expand it to[[(class) alloc] init]. Type aa-escape for an array. 53 others to choose from.
Custom Project and File Templates
Similarly, Dylan has a post on Custom File Templates that demonstrates how to create new templates that will show up under New File menus.
User Scripts in Apple’s Xcode Workspace Guide – Perform programmatic manipulation of (selected) text in files.
Instance variable to synthesized property (an Xcode user script) by Matt Gallagher (Profile) - Xcode User Scripts aren’t intended to work on multiple files. In this post, Matt demonstrates scripting changes to both header and implementation files.
Xcode and Git
Marcus Zarra (Profile) wrote about making Git automatically inject the build number into the application bundle.
Your favorite Xcode trick not listed? Add a comment! We can always run a second Xcode tweaks post (attributing tips to their authors).