11 Xcode Keyboard Shortcuts to Make You More Productive

If you’re a developer and use keyboard shortcuts in your editor, you probably already know a bunch of Xcode keyboard shortcuts. You know you can:

  • find text in a file with ⌘F
  • create a new file with ⌘N
  • open a new tab with ⌘T
  • close a tab with ⌘W

(Yep, just like in all the other editors out there, these work in Xcode, too.)

So you just need to know the relevant keyboard shortcuts in Xcode – the ones that are different from every other editor you’ve used. You need to know how to run your app. How to open a file quickly. How to show two files side-by-side. And, perhaps most importantly, how to get auto-complete to help you out.

This list is for you. (It goes to eleven.)

1. Run: ⌘R (Command + R)

Write some code, then build and run your app in the simulator or on device with ⌘R. I do this at least a hundred times a day. Learn it.

Run shortcut

2. Show Standard Editor: ⌘⏎ (Command + Enter)

The Standard Editor is the view where you have just one file open, and you can show it with ⌘⏎. It’s what I use most of the time when I’m writing code.

Standard Editor keyboard shortcut

3. Show Assistant Editor: ⌥⌘⏎ (Option + Command + Enter)

The Assistant Editor shows two files at once, and it’s useful especially when connecting Storyboard views to code. I also like to use it when writing unit tests so I can see both the class and its tests at the same time.

Assistant Editor keyboard shortcut

4. Open Quickly: ⇧⌘O (Shift + Command + O)

To open a file quickly, press ⇧⌘O, then type the filename. From there you can:

  • open the file in the Standard Editor (the single-file view) by pressing (Enter)
  • open the file in the Assistant Editor (the second pane in the split-pane) by pressing ⌥⏎ (Option + Enter)

Open Quickly

5. Clean: ⇧⌘K (Shift + Command + K)

This one is useful when you’re pretty sure the code you wrote is correct, but when you run it, something is broken. Clean the project (⇧⌘K) and run it again, and maybe – just maybe – your code is actually right. If a clean fails to solve your problem, you might need to show the debug area…


6. Show/Hide Debug Area: ⇧⌘Y (Shift + Command + Y)

Show the debug area – which contains the variables view and console – with ⇧⌘Y. The variables view shows the state of all the variables in scope when your app stops on a breakpoint. In the console you’ll see anything you’ve logged as your app runs. And when you’re finished debugging, hide the debug area with the same shortcut.

Show Debug Area

7. Show/Hide Navigator: ⌘0 (Command + 0)

The left pane, known as the Navigator, can get in the way when you’re not navigating. I keep it closed almost all the time, then open it again with ⌘0 when I need to add a new file to my project or to navigate the project structure as I hunt for a file.

Show Navigator

8. Show/Hide Utilities: ⌥⌘0 (Option + Command + 0)

The pane on the right, called Utilities, can also get in the way when not in use. It’s generally only useful to me when I’m working in a storyboard, so I use ⌥⌘0 to toggle it when I switch between storyboard and code files.

Show Utilities

9. Find text in Project: ⇧⌘F (Shift + Command + F)

When you’re trying to find specific text in your project, ⌘⇧F is the way to do it.

Find in Project

10. Show/hide completions: (Escape) OR ⌃Space (Control + Space)

Type some code, use either or ⌃Space to toggle auto-complete (I’m hooked on Escape), and Xcode will offer a few intelligent suggestions to complete your code. You can cycle through the list with the up/down arrows, which is probably obvious. Additionally, you can:

  • press (Tab) to finish the current word
  • press (Enter) to select the auto-complete suggestion

Show completions

11. Re-Indent code: ⌃I (Control + I)

I often refer to this as “formatting code,” but it’s labeled as “Re-Indent” in Xcode. Whatever you call it, you can put the right amount of space at the beginning of each line by selecting it, then pressing ⌃I. You can also re-indent a single line without selecting by simply pressing ⌃I.


Update: Here are a few reader favorites.

“To comment / uncomment selected code quickly: Command + /” – Hemang

“I like to use Control + 1 while the cursor is on the function name to find out who the callers are.” – A.C