The Complete Guide for Swift and SwiftUI
If you are an iOS developer working daily with Swift, SwiftUI, and Xcode, there is one skill that clearly separates an average developer from a highly productive one: mastering Xcode keyboard shortcuts.
Xcode is Apple’s official IDE for Swift programming on iOS, macOS, and watchOS. It is designed to be used primarily with the keyboard. Every Xcode shortcut you learn reduces mouse usage, speeds up your workflow, and allows you to focus on what really matters: writing clean Swift code and building great user interfaces with SwiftUI.
In this tutorial you’ll find a complete and structured list of Xcode shortcuts, explaining what each shortcut does, why it’s useful, and how it applies to real-world Swift and SwiftUI projects.
You can also download the Xcode shortcuts PDF for iOS developers here.
Why learning Xcode shortcuts matters
A professional iOS developer spends thousands of hours inside Xcode. Knowing shortcuts allows you to:
- Write Swift code faster
- Navigate large projects efficiently
- Refactor SwiftUI views with confidence
- Debug apps more effectively
- Increase productivity across iOS, macOS, and watchOS
Mastering Xcode is not optional — it’s a core skill for every iOS developer.
Basic Xcode shortcuts
⌘ + N — Create a new file
Creates a new file in the project (Swift file, SwiftUI View, Test file, etc.). Heavily used in modular Swift programming.
⌘ + O — Open file or project
Opens an existing project or any external file.
⌘ + S — Save
Saves the current file. Even with auto-save, this shortcut is still useful for important changes.
⌘ + W — Close tab
Closes the current file without quitting Xcode.
⌘ + Q — Quit Xcode
Closes Xcode completely.
Navigation shortcuts in Xcode (essential)
⌘ + Shift + O — Open Quickly
One of the most important Xcode shortcuts for any iOS developer.
Allows you to:
- Open any file
- Jump to SwiftUI views
- Search classes, structs, and functions
Perfect for large SwiftUI projects.
⌘ + Shift + J — Reveal file in Project Navigator
Quickly shows the current file inside the project structure.
⌘ + 1 — Project Navigator
Displays the full project file hierarchy.
⌘ + 2 — Source Control Navigator
Access Git branches, commits, and changes.
⌘ + 3 — Symbol Navigator
Lists all classes, structs, enums, and Swift functions in the project.
⌘ + 4 — Find Navigator
Search text across the entire project. Extremely useful for refactoring.
⌘ + 5 — Issue Navigator
Shows build errors and warnings.
Swift and SwiftUI code editing shortcuts
⌘ + / — Comment or uncomment code
Comments or uncomments selected lines. Ideal for testing SwiftUI changes quickly.
⌘ + ] — Indent right
⌘ + [ — Indent left
Keeps Swift code properly formatted, which is especially important in SwiftUI.
⌘ + Shift + A — Quick actions
Shows contextual actions such as:
- Automatic fixes
- Refactoring suggestions
- Compiler error resolutions
Autocompletion and help shortcuts
Esc — Autocomplete
Displays autocomplete suggestions for Swift and SwiftUI (views, modifiers, properties).
⌥ + Click — Inline documentation
Shows documentation for the selected symbol without leaving the editor.
⌘ + Shift + L — Library
Opens the SwiftUI library with views, controls, and modifiers.
⌘ + ⌥ + Shift + ? — Quick Help Inspector
Displays detailed documentation for the selected element.
Selection and multi-cursor editing shortcuts
⌘ + A — Select all
Selects the entire file content.
⌘ + L — Select current line
Selects the entire line where the cursor is located.
⌥ + Shift + Click — Multiple cursors
Allows editing multiple lines at once. Extremely useful for SwiftUI modifiers.
Moving lines and blocks
⌥ + ⌘ + ↑ — Move line up
⌥ + ⌘ + ↓ — Move line down
Reorganizes SwiftUI views inside VStack, List, or ZStack without breaking the code.
Build and run shortcuts
⌘ + B — Build
Builds the project without running it.
⌘ + R — Run
Runs the app on the simulator or a physical device.
⌘ + . — Stop
Stops the running app.
⌘ + Shift + K — Clean Build Folder
Cleans the build folder. Very useful when Xcode or SwiftUI previews misbehave.
iOS Simulator shortcuts
⌘ + Shift + H — Home
Simulates pressing the Home button.
⌘ + Shift + H (twice) — App Switcher
Opens the app switcher.
⌘ + Shift + M — Shake
Simulates the shake gesture.
⌘ + K — Toggle hardware keyboard
Enables or disables the simulator’s hardware keyboard.
SwiftUI Preview shortcuts
⌘ + ⌥ + Enter — Show / hide Canvas
Toggles the SwiftUI preview canvas.
⌘ + ⌥ + P — Resume previews
Reloads SwiftUI previews when they freeze.
⌘ + ⌥ + Return — Interactive preview
Interact with the SwiftUI view directly inside the canvas.
Debugging shortcuts in Xcode
⌘ + Shift + Y — Show / hide console
Toggles the debug console.
⌘ + \ — Toggle breakpoint
Adds or removes a breakpoint on the current line.
⌘ + Y — Enable / disable all breakpoints
Run the app without stopping at breakpoints.
F6 — Step Over
F7 — Step Into
F8 — Step Out
Controls step-by-step execution while debugging.
Assistant Editor shortcuts
⌘ + ⌥ + Enter — Assistant Editor
Shows related files, previews, or test files.
⌘ + Return — Standard editor
Returns to the single-editor layout.
Refactoring shortcuts in Swift and SwiftUI
⌘ + Click — Rename symbol
Renames classes, structs, or SwiftUI views across the entire project.
⌘ + Shift + A → Refactor
Allows you to extract functions, views, and simplify complex SwiftUI code.
Source control (Git) shortcuts
⌘ + ⌥ + C — Commit
Opens the Git commit window in Xcode.
⌘ + ⌥ + X — Discard changes
Quickly reverts local changes.
⌘ + ⌥ + B — Create new branch
Creates a new Git branch directly from Xcode.
Customizing Xcode shortcuts
You can customize any Xcode shortcut from:
Xcode → Settings → Key Bindings
This allows you to adapt Xcode to your workflow as an iOS developer or match shortcuts from other IDEs.
Conclusion: mastering Xcode shortcuts means mastering SwiftUI
Learning and using Xcode shortcuts is not just about speed — it’s about focus, flow, and code quality.
If you work with Swift, SwiftUI, and Xcode on iOS, macOS, or watchOS, these shortcuts will help you:
- Write Swift code faster
- Reduce errors
- Refactor with confidence
- Enjoy development more
If you have any questions about this article, please contact me and I will be happy to help you 🙂. You can contact me on my X profile or on my Instagram profile.