For iPhone development guys (and Mac as well), we all want to be as productive as possible. And one of our important tools is Xcode. I can even say that if we can master of Xcode, we can double our productivity. The reason is not only the time that the tool can save us but the number of times it breaks our workflow, or make us become bored/tired of our jobs. We are all humans, and no human in the world wants to do the job that a machine can do. Ok, stop talking and I will show you my summary of tips/tricks and techniques that I feel very very useful for me.
Many of these tips is from this stackoverflow post (I just list what I feel is most productive), 2 famous videos called “Becoming productive in XCode”, and a famous cheat sheet that almost all of us know “Complete Xcode Keyboard Shortcut List”
I also recommend you to go there and take a look because this post may be really personal and lack excellent tips that you want.
1/ Basic Hot Keys
File Cursor Movement
- Header/Source File Switching: Option + Command + Up Arrow
- Last cursor point switch back and forward: Option + Command + Left (Right) Arrow
- Jump to Definition of a symbol : Command + Double-Click on a symbol
- Find Text in Documentation of a symbol: Option + Double-Click on a symbol: (Only works if you have they symbol’s Doc Set installed.)
- (previous) next auto-completion argument : (Shift) + Control + /
- Auto completion pop-up list : Escape or Control + comma
- (previous) next Auto completion choices movement: (Shift) + Control + period
- Cursor movement between words : Option + Left (Right) Arrow
- Cursor movement camel-cased parts of a word: Control + Left (Right) Arrow
- Beginning or end of line: Command + Left (Right) Arrow
- Jump to class in Xcode : Command + Double-click on an object in Interface Builder’s
- Drag a customized object back to Interface Builder’s Library for later reuse.
- Object overlap, see object menu under mouse: Control + Shift + Click on an object :
- Bold line in the function list: #pragma mark Foo
- Auto complete the pragma: pm or #p
- Notation convention: // TODO: or // FixMe
- Commenting a line: Command + /
2/ Advanced Hot Keys
With advanced hot keys, you will rarely need to use the mouse. Because, everything you need to do with the mouse, you can do it with the hot keys.
- Open File Quickly : Command + Shift + D and don’t forget that open quickly uses the current word as a search term.
- Popup list of methods and symbols in the current file : Control + 2
- Look up current symbol: Control + Command + ?
- Editor area to full screen : Command + Shift + E
- Debug and Editor Mode switch in All-In-One XCode mode : Command + Shift + B
3/ Some useful scripting
I will tell you more about scripting in the next part, but currently, I think this list is basic enough:
Default Auto Completion list, show when you type
defaults write com.apple.Xcode XCCodeSenseAutoSuggestionStyle List
Turn Off Undo Warning
defaults write com.apple.Xcode XCShowUndoPastSaveWarning NO
Hope that now you can code iPhone app much faster with XCode