Xcode keyboard shortcuts

Xcode is Apple's IDE for building apps across iPhone, iPad, Mac, Apple Watch, and Apple TV. Between its navigators, inspectors, assistant editors, and simulators there is a lot of interface to wrangle. Learning the keyboard shortcuts keeps your hands off the trackpad and your focus on Swift, not on window management. This cheat sheet covers 58 default shortcuts.

Build, Run & Test

BuildCmd+B
RunCmd+R
Stop runningCmd+.
Run testsCmd+U
Clean build folderCmd+Shift+K
AnalyzeCmd+Shift+B
Profile with InstrumentsCmd+I

Navigation

Open Quickly (fuzzy file/symbol search)Cmd+Shift+O
Go backCtrl+Cmd+Left
Go forwardCtrl+Cmd+Right
Jump to definitionCtrl+Cmd+J
Jump to lineCmd+L
Reveal current file in Project navigatorCmd+Shift+J
Move focus (jump bar picker)Cmd+J
Jump to next issueCmd+'
Jump to previous issueCmd+"
Open developer documentationCmd+Shift+0
Show Quick Help for symbolOption+Click

Editing

Toggle comment on line/selectionCmd+/
Re-indent selectionCtrl+I
Shift line rightCmd+]
Shift line leftCmd+[
Move line upCmd+Option+[
Move line downCmd+Option+]
Edit all in scope (rename local symbol)Ctrl+Cmd+E
Show code completion suggestionsEsc
Delete to end of lineCtrl+K
Zoom editor text inCmd+Plus
Zoom editor text outCmd+Minus

Code Folding

Fold current blockCmd+Option+Left
Unfold current blockCmd+Option+Right
Fold all methods and functionsCmd+Option+Shift+Left
Unfold all methods and functionsCmd+Option+Shift+Right

Find & Replace

Find in fileCmd+F
Find and replace in fileCmd+Option+F
Find in workspaceCmd+Shift+F
Find and replace in workspaceCmd+Option+Shift+F
Find nextCmd+G
Find previousCmd+Shift+G
Use selection for findCmd+E

Debugging

Toggle breakpoint on current lineCmd+\
Activate/deactivate all breakpointsCmd+Y
Pause/continue executionCtrl+Cmd+Y
Step overF6
Step intoF7
Step outF8

Workspace & Panels

Show/hide Navigator panelCmd+0
Show Project navigatorCmd+1
Show/hide Inspectors panelCmd+Option+0
Show/hide Debug areaCmd+Shift+Y
New tabCmd+T
Next tabCmd+Shift+]
Previous tabCmd+Shift+[
Close file/tabCmd+W
Toggle full screenCtrl+Cmd+F

SwiftUI & Source Control

Show/hide SwiftUI canvasCmd+Option+Enter
Resume/refresh SwiftUI previewCmd+Option+P
Commit changesCmd+Option+C

Put your top Xcode shortcuts on real keys

The five Xcode actions most worth binding to a physical macropad key:

Cmd+R Run The build-run-check loop is the heartbeat of iOS development; a physical run key removes all friction.
Cmd+. Stop running Instantly kills the simulator session so you can edit and re-run without reaching for the mouse.
Cmd+Shift+K Clean build folder The ritual fix for stale-build weirdness deserves its own panic button.
Cmd+Shift+O Open Quickly Single-press access to any file or symbol beats scrolling the navigator every time.
Cmd+\ Toggle breakpoint Dropping and clearing breakpoints dozens of times per debug session earns a hardware key.

I hand-build small-batch programmable macropads (QMK/VIA) in Barcelona. One press, any shortcut, any app.

See the macropads

Xcode shortcut FAQs

How do I quickly open a file in Xcode without the Project navigator?
Press Cmd+Shift+O for Open Quickly, then type part of the file, type, or symbol name. It fuzzy-matches across the whole workspace, including SDK headers.
What is the shortcut to refresh the SwiftUI preview in Xcode?
Press Cmd+Option+P to resume or refresh the preview canvas. Cmd+Option+Enter shows or hides the canvas itself.
How do I rename a variable everywhere in its scope in Xcode?
Place the cursor on the symbol and press Ctrl+Cmd+E (Edit All in Scope). Typing then updates every occurrence in that scope simultaneously. For project-wide renames, use the Refactor > Rename menu.
How do I clean the build folder in Xcode?
Press Cmd+Shift+K to clean the build folder. This deletes intermediate build products and is the classic first fix for mysterious build errors.
Can I customize keyboard shortcuts in Xcode?
Yes. Go to Xcode Settings > Key Bindings, where every command can be rebound. You can also duplicate the default key binding set to keep your changes separate.