14 Xcode Keyboard Shortcuts - To Make You More a Productive iOS Developer

Xcode 6 Keyboard Shortcuts

Learning the Xcode keyboard shortcuts is going to make you a more productive and faster iOS or Mac app developer. You can save time by practicing these 14 Xcode Keyboard Shortcuts in your daily code. 

My design friends from Brault & Barnes put together a great PDF that looks amazing. Download a copy and print it out—you can hang it on your wall for quick reference as you begin to learn more shortcuts. The more you use these keyboard shortcuts with Xcode, the more time you will save. Eventually these shortcuts will become second nature.

There are many keyboard shortcuts in Xcode that can make yourself a more efficient programmer. They can help you quickly navigate around your code files to find and fix bugs, or to add new features to your apps.

When you’re in the zone, you want to be able to access the code files quickly, or the adjust Xcode’s panels to fit your small laptop screen.

The following keyboard shortcuts for Xcode are the best ones to learn first. You will probably use them every day after you learn them.

Xcode Navigation Keyboard Shortcuts

1. Project Navigator: Command + 1

Quickly view all your code, images, and user interface files.

The Project Navigator is your central hub for all code, interface, and image files

The Project Navigator is your central hub for all code, interface, and image files

2. Show/Hide Navigator Panel: Command + 0

When you’re short on screen space, you’ll want to close anything that gets in the way. The happens a lot if you use the Assistant Editor (tuxedo) or when you design the user interface and connect it to code.

Show and hide the Navigator Panel

Show and hide the Navigator Panel

3. Show/Hide Utilities Panel: Command + Option + 0

The Utilities Panel is primarily used when you’re editing your user interface files. If you are only writing code, you can hide it.

 

Show and hide the Utilities Panel

Show and hide the Utilities Panel

4. Open file in Assistant Editor: Option + Left-click on file in Project Navigator

A quick way to open the Assistant Editor (Tuxedo button top right) is to Option click on a file you want to open side by side with the currently opened file.

Show multiple code or interface files with the Assistant Editor

Show multiple code or interface files with the Assistant Editor

Download the Keyboard Shortcut PDF

Xcode Search Keyboard Shortcuts

When you are editing code, adding new code, or trying to fix a bug, searching is the fastest way to find something. Instead of scrolling through hundreds of lines of code you can find all occurrences of a variable, or jump to a specific line of text.

5. Find Navigator (ie. Search): Command + Shift + F

Find all the times you mentioned a variable or method name with the project search. You can match based on case, or ignore upper and lower case letters. 

You can also replace all occurrences of a variable name with a new variable name.

Search for text or symbols in your Xcode project

Search for text or symbols in your Xcode project

6. File Jump Bar: Control + 6 (Type the method/variable name + enter to jump)

Jump to a line of code within your current code file. If you have hundreds or thousands of lines of code, you can quickly narrow down where you need to insert code to support a new app feature.

Jump bar allows quick access to methods or variables within a code file

Jump bar allows quick access to methods or variables within a code file

7. Open Quickly: Command + Shift + O

If you prefer to only use the keyboard and not the mouse, you’re going to enjoy Open Quickly. It let’s you just type and jump to a method definition or a specific code file.

Open a file quickly or jump to specific method using Open Quickly

Open a file quickly or jump to specific method using Open Quickly

8. Jump Bar and Open Quickly Search Typing Shortcut

You can type the first letter of each word, which allows you to quickly switch to a file or find a particular line of code.

Example, in ViewController.Swift press Command + Shift + O and then type vDL. The first result will be the function with the name viewDidLoad()  

Type less and search more with using starting letters for method names: i.e. vDL for viewDidLoad

Type less and search more with using starting letters for method names: i.e. vDL for viewDidLoad

9. (Objective-C or C++) Switch between .h and .m files: Control + Command + Up Arrow

If you are writing Objective-C, C++, or using Open Source code written in either language, you might need to lookup existing code.

You can quickly switch between two related code files, like the header and implementation files in Objective-C using this Control + Command + Up Arrow shortcut.

If you’re writing code in Swift, you won’t need to worry about this shortcut, since Swift uses a single code file.

App Building and Cleanup

To try out your new app you have to run it, and occasionally Xcode doesn’t feel well, so you may have to clean it up.

These shortcuts will keep you writing code without stopping to use the mouse as much.

 

10. Run the app: Command + R

When I write code, I routinely use this command to make sure the app is running bug free. The more often you test your app the better, since you can find and fix bugs early, before they become big problems.

Run your first iPhone app - Press Play!

Run your first iPhone app - Press Play!

11. Clean the project: Command + Shift + K

Occasionally Xcode will freeze, or something in your app becomes unresponsive or unpredictable. When that happens you’ll first want to clean and then re-run the Xcode project.

If that still doesn’t fix the problem, close Xcode and re-open it again. 

Try to run the app, and if that doesn’t work, you need to see if there’s an error message that you can Google for more help.

You shouldn’t have to do this too often, since it’ll make building your app slower. It removes all the intermediary files and recreates them which takes more time to complete.

Clean up Xcode when it fails to work

Clean up Xcode when it fails to work

12. Build the app: Command + B

Checking to make sure the code you write is in working order is something you’ll want to do often.

Even though Xcode checks it shortly after writing, it can sometimes be delayed, or give false errors. Building your app project allows you to make sure it’s in working order before you go to code the next feature.

You don’t always have to run the app, if you are making minor changes, and that’s where building can help you do a quick check, so that you can get back to adding the next line of code.

Build your code to make sure you don't have any errors - quickly double check your work

Build your code to make sure you don't have any errors - quickly double check your work

Documentation and Help

Learning how to help yourself is equally important. If you haven't already taken a look at the Xcode documentation, use these shortcuts to lookup related code reference. 

Read or skim some of the reference guides to get better acquainted with the code that Apple provides, which you can use to make more robust iPhone apps.

13. Documentation and Reference: Command + Shift + 0 (Zero)

After you install all the documentation with Xcode, which it should do in the background after installing it. You can search the documentation offline, which is great when you’re traveling and you’re trying to figure out how to add a new screen or feature to your app.

Open the Documentation and Reference and search for a keyword that you’ve seen in code. You should be able to find some additional resources and sample projects through the Xcode documentation.

Find out how to use code with Documentation and reference guides

Find out how to use code with Documentation and reference guides

14. Quick Help: Option + Left-click on class or method name

Inline help can make it easier to learn what a class or piece of code is actually doing. There’s a lot of code that’s already written, which you can leverage with the help of Quick Help.

Hold Option and Left-click on a variable, class, or method name to get more details. You can quickly jump to the documentation, if you click on the reference link in the bottom of the popup.

Pro Tip: Jump directly to the reference guide by double-clicking the left mouse button while holding Option over a class name.

Get Quick Help to reference while you write code

Get Quick Help to reference while you write code

What Shortcuts do you use?

Share what hotkeys make you faster or more effective.

Reader Tips

One of my new favorites I learned just recently and use it often is Command + Shift + J, which reveals the file you currently have open in the project navigator. I spent my days in a very large codebase, so this is a very fast way to jump around.
— weendex
I’m a big fan of CTRL + 1 which opens the “Show Related Items” popup. If you have the cursor in any method and hit CTRL + 1 you can easily access all the callers and callees of the current method via this popup. I am constantly navigating up through the callers of a method to see how it’s used.
— skoll
Cmd + . to stop the iOS Simulator is generally pretty handy as well.
— weendex
One that isn’t in the article that I use all the time is Command + Option + Shift + Left-click a file. This presents you with a little popover and you can say where you want it opened in, an assistant editor, a tab, a window, etc.
— Cheezybob
Or if you really want to get serious about developing stuff get AppCode! http://www.jetbrains.com/objc/
— martinni39

Download the 14 Keyboard Shortcuts PDF

Get the printable PDF with all of the Xcode Keyboard Shortcuts.