Using keyboard shortcuts is key of being productive and efficient when working with a development environment like Xcode. In this post, I will show you my favorite advanced and hidden Xcode shortcuts.
If you are new to Xcode, you may want to checkout my post on basic Xcode keyboard shortcuts first.
Before starting, here is a quick key reference:
⌘ - Command
⇧ - Shift
⌥ - Option/Alt
⌃ - Control
1. Quickly open two files side by side
⌘ ⇧ O in combination with ⌥
Most developers already know the useful Open quickly... command. And it becomes even more powerful when using it with ⌥.
Use ⌘ ⇧ O, then enter the file name, then click ⌥ right before selecting the file. The new file will open in a separate editor, so you can continue working on your current file while having access to the new opened file.
The ⌥ click also works when selecting a file in the project navigator.
2. Quickly jump to a specific method in a file
⌃ 6 in combination with typing the method name
This one is especially useful for bigger files with many methods, where scrolling becomes annoying very fast.
Use ⌃ 6 to open the documents structure, then start typing the methods name, then use enter to jump to the method. You can skip letters when typing, Xcode will do the work for you.
3. Reveal in project navigator
⇧ ⌘ J This one is really handy when you want to see the file you are currently working on in project navigator.
5. Filter in navigator
⌥ ⌘ J
The filter action is different from the standard find. It only will filter for file names.
6. Repeat the last test
⌃ ⌘ ⌥ G
This one is really handy when writing tests to repeat the last test you were running.
7. Reindent code
Useful when code is out of place, for example after refactoring. It can be done by cutting and pasting the code or simply with the reindent shortcut.
8. Disable / enable breakpoints
This one can be really useful when debugging your code.