SwiftUI has completely changed the way iOS developers build user interfaces across Apple platforms. Its declarative approach, real-time previews, and view composition make development incredibly productive… if you know how to use Xcode efficiently.
This is where Xcode shortcuts become essential. When working with SwiftUI, the IDE is constantly alive: you write code, update previews, tweak state, navigate between views, and debug continuously. Mastering the right keyboard shortcuts makes a massive difference in your daily workflow.
In this tutorial, you’ll find a complete, SwiftUI-focused list of Xcode shortcuts, clearly explaining what each shortcut does and how to use it in real SwiftUI projects for iOS, macOS, and watchOS.
You can also download the PDF file of Xcode shortcuts for SwiftUI developers here.
Why shortcuts matter even more in SwiftUI
With UIKit, you could afford a few extra clicks.
With SwiftUI, you really can’t.
SwiftUI development involves:
- Constant code changes
- Heavy use of previews
- Rapid modifier editing
- Frequent refactoring of views
- Navigating across many small structs
Xcode shortcuts help you maintain the mental flow that SwiftUI development demands.
Basic Xcode shortcuts applied to SwiftUI
⌘ + N — New SwiftUI file
Creates a new SwiftUI View file. Essential when building small, reusable SwiftUI components.
⌘ + O — Open project
Opens another SwiftUI project or a quick prototype.
⌘ + W — Close SwiftUI view
Closes the current file without quitting Xcode. Very useful when working with many views at once.
Fast navigation between SwiftUI views
⌘ + Shift + O — Open Quickly (critical for SwiftUI)
This is the most important shortcut for SwiftUI developers.
It allows you to:
- Open any
View - Jump to
App,Scene, orPreview - Search structs by name
Perfect when your SwiftUI project grows to dozens of views.
⌘ + Shift + J — Reveal file in Project Navigator
Quickly locate the SwiftUI view you’re currently editing inside the project structure.
⌘ + 1 — Project Navigator
Instant access to all your SwiftUI files organized by folders.
⌘ + 3 — Symbol Navigator
Lists every View, @State, @Observable, function, and extension in the project.
Extremely helpful for understanding large SwiftUI architectures.
SwiftUI code editing shortcuts
⌘ + / — Comment or uncomment modifiers
Comments out selected SwiftUI code, useful for temporarily disabling modifiers:
// .padding()Great for quick preview experiments.
⌘ + ] / ⌘ + [ — Indentation
SwiftUI relies heavily on indentation for readable view hierarchies.
These shortcuts keep your Swift code clean and structured.
⌘ + Shift + A — Quick actions in SwiftUI
Allows you to:
- Fix compile-time errors
- Apply automatic fixes
- Refactor SwiftUI code
Very useful when Xcode detects issues with bindings or state.
Autocompletion shortcuts for SwiftUI
Esc — Autocomplete views and modifiers
Shows suggestions for:
TextVStack,HStack,ZStack- Modifiers like
.padding(),.background(),.frame()
Essential for fast SwiftUI development.
⌥ + Click — Modifier documentation
Shows inline documentation for SwiftUI modifiers such as .onAppear, .task, .animation.
Perfect for learning SwiftUI while coding.
⌘ + Shift + L — SwiftUI Library
Opens the library containing:
- SwiftUI views
- Modifiers
- Shapes
- Controls
You can drag components directly into your SwiftUI code.
Text selection and multi-edit shortcuts (SwiftUI power user)
⌘ + L — Select current line
Selects an entire line, ideal for duplicating modifiers.
⌥ + Shift + Click — Multiple cursors
Edit multiple modifiers or view lines at the same time.
Example:
Change .padding() to .padding(.horizontal) across several views simultaneously.
⌥ + ⌘ + ↑ / ↓ — Move view blocks
Moves entire SwiftUI views inside a VStack, List, or ZStack without breaking the hierarchy.
Extremely useful when reorganizing layouts.
SwiftUI Preview–specific shortcuts
⌘ + ⌥ + Enter — Show / hide Canvas
Toggles the SwiftUI preview Canvas.
Essential when switching between focused coding and visual work.
⌘ + ⌥ + P — Resume previews
Reloads SwiftUI previews when they freeze or stop updating.
Probably the most-used shortcut for any SwiftUI developer.
⌘ + ⌥ + Return — Interactive preview
Allows you to interact with the SwiftUI view directly inside the Canvas.
Perfect for testing buttons, navigation, and state changes.
Build and run shortcuts in SwiftUI projects
⌘ + B — Build
Builds the SwiftUI project without running it.
Great for quickly catching errors that affect previews.
⌘ + R — Run
Runs the SwiftUI app on the simulator or a physical device.
⌘ + . — Stop
Stops the running app.
⌘ + Shift + K — Clean Build Folder
Cleans the build folder when Xcode or SwiftUI previews behave unexpectedly.
Debugging shortcuts adapted to SwiftUI
⌘ + Shift + Y — Console
Shows the debug console to inspect logs, async tasks, and SwiftUI runtime messages.
⌘ + \ — Toggle breakpoint
Adds or removes a breakpoint inside body, .task, or .onAppear.
⌘ + Y — Enable / disable all breakpoints
Perfect for running previews without interruptions.
F6 / F7 / F8 — Step Over / Into / Out
Useful for debugging SwiftUI logic, especially inside ViewModels and state-driven code.
Assistant Editor shortcuts for SwiftUI
⌘ + ⌥ + Enter — Assistant Editor
Shows:
- SwiftUI previews
- Tests
- Related files
Very helpful when working with PreviewProvider and main views simultaneously.
⌘ + Return — Standard editor
Returns to a single-editor layout.
Refactoring shortcuts in SwiftUI projects
⌘ + Click — Rename SwiftUI views
Renames a SwiftUI View and updates all references automatically.
Essential when refactoring reusable SwiftUI components.
⌘ + Shift + A → Refactor
Allows you to:
- Extract views
- Extract functions
- Simplify complex SwiftUI code
Source control shortcuts for SwiftUI projects
⌘ + ⌥ + C — Commit changes
Opens the Git commit panel directly inside Xcode.
⌘ + ⌥ + X — Discard changes
Quickly reverts local changes in SwiftUI files.
Customizing Xcode shortcuts for SwiftUI
Go to:
Xcode → Settings → Key Bindings
From there you can:
- Create custom preview shortcuts
- Adapt Xcode to your SwiftUI workflow
- Match shortcuts from other IDEs
Conclusion: SwiftUI + Xcode shortcuts = real productivity
SwiftUI is designed to be fast, expressive, and modern. But without mastering Xcode shortcuts, you’re leaving a huge amount of productivity on the table.
As an iOS developer, learning these shortcuts will help you:
- Build SwiftUI interfaces faster
- Refactor views with confidence
- Work more efficiently with previews
- Stay focused on Swift programming
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.