Xcode Keyboard Shortcuts
Xcode's shortcuts split across several genuinely distinct workflows bundled into one application — writing and navigating Swift or Objective-C code, laying out interfaces visually in Interface Builder, and running/debugging against the iOS Simulator or a connected device — and a developer moving between these contexts throughout the day relies on different shortcut clusters for each. Jump-based navigation (to a symbol's definition, to a related file, to a specific line) is disproportionately important in Xcode compared to some other IDEs, since Apple's frameworks are large and cross-referencing between a view controller, its storyboard, and related model code happens constantly. Being Mac-only, every shortcut here uses Cmd as the base modifier, often combined with Option or Control for secondary variants, with no Windows or Linux equivalent since Xcode has never been ported off macOS. Because Xcode bundles together what would be several separate applications in other development ecosystems — a text editor, a visual UI designer, a device simulator, and a full debugger — the shortcut set is unusually broad for a single IDE, and most developers only ever become fluent in the subset that matches how they personally build apps, whether that's a code-first approach that barely touches Interface Builder or a heavily visual, storyboard-driven approach that leans on it constantly. The jump-to-definition and related-file navigation shortcuts tend to be the highest-leverage ones to learn early, since Apple's frameworks encourage splitting related code across several files (a view controller, its storyboard entry, and any associated extensions or delegates), and manually locating each one by hand adds up to real lost time across a working day.
Navigation Search
| Action | Windows | Mac | Description |
|---|---|---|---|
| Open Quickly (jump to file/symbol) | — | Cmd+Shift+O | Brings up a fuzzy-matching search field that resolves a partial name into a file, class, method, or symbol anywhere in the project — the single navigation shortcut most Xcode developers reach for before any other. |
| Jump to Definition | — | Cmd+Click, or Ctrl+Cmd+J | Takes you straight to the definition of whatever symbol sits under the cursor, whether that definition lives in your own project files or in an imported framework's header. |
| Open Related Items menu | — | Ctrl+1 (jump bar related-items icon) | Opens a menu of files related to the currently open one — a view controller's XIB or Storyboard, its superclass, its test file, or recent history — a fast way to cross-reference connected files without manually searching the project navigator. |
| Find in Project | — | Cmd+Shift+F | Opens project-wide search across every file, distinct from Cmd+F's single-file search, essential for finding every usage of a specific string or symbol across a large codebase. |
Editing
| Action | Windows | Mac | Description |
|---|---|---|---|
| Comment/uncomment selected lines | — | Cmd+/ | Drops a // in front of whichever line the cursor sits on, or every line in the current selection if several are highlighted, so you can disable code temporarily without deleting anything. |
| Re-indent selected code | — | Ctrl+I | Reformats the selected code — or the entire file when nothing's highlighted — to match Xcode's configured indentation rules, handy for cleaning up code pasted in from a source with different formatting conventions. |
| Move line up | — | Cmd+Option+[ | Moves the current line or selected block up by one line, reordering code without cutting and pasting manually. |
| Fold/unfold current code block | — | Cmd+Option+Left / Right | Collapses the current function, class, or code block down to a single summarized line, or expands a previously folded block back open, useful for temporarily hiding irrelevant code while focusing on a specific section. |
| Duplicate current line/selection | — | Cmd+Ctrl+Shift+/ (varies) or Edit menu > Duplicate | Creates a copy of the current line or selection directly below it, faster than manually selecting, copying, and pasting for quickly repeating a similar statement before editing the differences. |
| Jump to specific line number | — | Cmd+L | Brings up a lightweight line-number field docked at the top of the editor; typing a number and hitting Return snaps straight to it, which is the fastest way to reach the exact line cited in a crash report or a compiler diagnostic without touching the mouse or the jump bar. |
Build Run Debug
| Action | Windows | Mac | Description |
|---|---|---|---|
| Build and Run | — | Cmd+R | Compiles the project and launches it on the currently selected simulator or connected device, the single most-used command during active development. |
| Build (without running) | — | Cmd+B | Compiles the project to check for errors without launching it, faster than a full Build and Run when you just want to confirm the code compiles cleanly. |
| Stop running app | — | Cmd+. | Terminates the currently running app on the simulator or device and stops the debugger session attached to it. |
| Toggle breakpoint | — | Cmd+\\ | Drops a blue breakpoint marker on the current line that also registers in the Breakpoint Navigator sidebar for later enabling, disabling, or editing with conditions; Xcode's debugger is LLDB under the hood, so a paused breakpoint hands control straight to the LLDB console at the bottom of the window for direct expression evaluation. |
| Step Over | — | F6 | Advances LLDB past whatever the highlighted line does and stops again on the next line, without following the debugger down into any function that line happens to call — the everyday stepping command for tracing your own logic without getting lost in Foundation or UIKit internals. |
Interface Builder
| Action | Windows | Mac | Description |
|---|---|---|---|
| Open Assistant Editor | — | Cmd+Option+Return | Opens a second editor pane alongside the main one, commonly used to view a Storyboard or XIB file's Interface Builder canvas next to its corresponding Swift source file simultaneously, essential for dragging out IBOutlet and IBAction connections. |
| Show Attributes Inspector | — | Cmd+Option+4 | Opens the Attributes Inspector in Interface Builder, exposing configurable properties like a button's title text or a label's font for whatever element is currently selected on the canvas. |
| Show Size Inspector | — | Cmd+Option+5 | Opens the Size Inspector panel, showing and letting you numerically adjust the exact frame dimensions and Auto Layout constraint values for the currently selected UI element on the canvas, more precise than dragging a resize handle by eye. |
| Show Connections Inspector | — | Cmd+Option+6 | Opens the Connections Inspector for the selected UI element, listing out every outlet and action tied to it so you can audit or delete an existing wire-up without tracing lines across the canvas by eye. |
Frequently Asked Questions
What's the practical difference between Cmd+Shift+O (Open Quickly) and Cmd+Shift+F (Find in Project)?
Open Quickly searches for and jumps to files, classes, and symbols by name — you're looking for a specific known thing and want to navigate straight to its definition or file. Find in Project instead searches the actual text content of every file for a matching string, useful when you're looking for every place a particular piece of text or code pattern appears throughout the codebase, rather than jumping to one specific named symbol.
Why does Jump to Definition (Cmd+Click) sometimes open a framework header instead of readable source?
For Apple's own system frameworks (UIKit, Foundation, and others), Xcode often only has access to the public interface header rather than the framework's actual private implementation source, since Apple doesn't ship the underlying source code for its closed frameworks — you'll see the method or class's declared signature and documentation comments, but not its internal implementation, which is expected and not a broken feature.
Why does the Assistant Editor sometimes show an unrelated file instead of the one I expect?
The Assistant Editor tries to intelligently guess a 'related' file based on the primary editor's current content — usually a Storyboard's corresponding view controller class, or vice versa — but its automatic guess can be wrong in projects with unconventional file naming or structure. The jump bar at the top of the Assistant Editor pane lets you manually navigate to the specific file you actually want it to show instead of relying on the automatic guess.
Why does Cmd+Click sometimes offer a menu of multiple destinations instead of jumping directly?
When the symbol under your cursor could resolve to more than one matching declaration — common with overloaded methods, or a protocol method implemented by several conforming types — Cmd+Click shows a small menu listing each possibility so you can pick the specific one you meant, rather than guessing which single definition you intended.
Why does Xcode sometimes show stale error messages after I've already fixed the code?
Xcode's live-issue indexing (the red and yellow markers shown while typing, before an actual build) occasionally lags behind rapid edits, especially in very large files or projects with heavy use of Swift generics and protocol extensions that are slower for the compiler's background indexer to re-resolve. A fresh Build (Cmd+B) forces a real compile pass that reflects the code's actual current state, which is more reliable than trusting the live in-editor markers alone when something looks inconsistent.
Why do some keyboard shortcuts stop responding after switching between light and dark mode or updating macOS?
This is rarely related to light/dark mode itself, but a macOS update occasionally resets or reassigns a small number of system-level keyboard shortcuts that happen to collide with a Xcode binding, particularly around function-key combinations that macOS's own Mission Control or input-source switching features can claim first. Checking System Settings > Keyboard > Keyboard Shortcuts for a newly conflicting system-level binding is the most common fix when a previously working Xcode shortcut goes quiet after an OS update.