Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hidden Features of Xcode 4

People also ask

How do I search for something in Xcode?

Use cmd + shift + f for complete Xcode search.

What is Xcode editor?

The Assistant Editor in Xcode is a second editor that automatically displays files that Xcode determines are most helpful to you based on the work you are performing in the primary editor. It's been used a lot in the Objective-C days where MyClass. h would be opened while editing MyClass.


If you like your code to look as good as it runs, you've undoubtedly used #pragma mark - and #pragma mark <name> to provide a nice visual grouping in the Xcode class dropdown list. Xcode 4 now combines these into a single #pragma mark - <name>.

More on pragma mark.

Xcode pragma mark


  • shift-cmd-opt click on a symbol lets you tell Xcode exactly where in the UI you want the navigated-to file to open.

  • cmd-ret makes the version editor / assistant (the right hand pane) go away

  • shift-cmd-Y to hide the debugger

  • cmd-0 to hide the navigator (left pane)

  • cmd-[1..n] switch between navigators on left

  • cmd-opt-[1..n] switch between utilities (thing generally on right)

  • ctrl-[1..n] switch between various related files in the editor

Overall, Xcode 4 tries to keep things consistent w/the hot keys. Cmd is for mainline commands. Adding modifiers is for analogous commands focused on one particular sub-feature.

(These are just the four that come to mind as the my most pounded upon shortcuts that I'm using constantly! I'm sure it'll change over time as my workflow is refactored into the new hotness.)


Xcode 4 adds a new "Code Snippets" feature, accessible via View > Utilities > Code Snippet Library. To add a new code snippet, select some text in the editor view and drag it into the snippet library. You can either drag a snippet out and drop it in your code to use it, or, much more conveniently, assign a completion shortcut to it.

When you type in that series of letters, it will automatically show up in the code completion pop-up menu as you type your code. For example, among many others, I have a snippet set up so that typing "svk" will expand to setValue:<#value#> forKey:<#key#>. This can save a lot of typing and/or fishing around in the autocompletion menu for the methods and other code expressions you use the most. Xcode ships with a bunch of built-in snippets that come in very handy as well.


New shortcut I use most often: triple-finger swipe (up or down) to swap counterparts (between the interface and implementation files). No more hand acrobatics!

Thanks to https://twitter.com/xctotd/status/48148271759241216