Developer Productivity

Essential Xcode Shortcuts for More Efficient Coding

Accelerate Your Coding Workflow

Peter Friese
Oct 14 · 7 min read

As developers, we spend a considerable amount of time in our IDE, so it’s worth becoming an expert in using it. Simply being able to edit code doesn’t cut it — you need to become proficient.

In The Pragmatic Programmer, the authors recommend choosing one editor, and using it for all editing tasks. The reasoning behind their recommendation is simple: once you’ve memorised all keyboard shortcuts, your productivity will soar.

While you could certainly use an editor like VS Code to edit your source code, as iOS / macOS / watchOS / tvOS developers, we’re somewhat bound to use Xcode, as it includes a lot more tools than just the source code editor.

Nevertheless, it pays off to know your way around Xcode and be proficient in the core editing and navigation commands to increase your productivity.

I’ve collected a list of my favourite keybindings and mouse commands — hope you’ll find them useful as well! All keybindings listed here use Xcode’s default keybinding — with one notable exception.

  • ⌘ = Command
  • ⌥ = Option/Alt
  • ⇧ = Shift
  • ⌃ = Control
  • ←→ ↑↓ = Arrow keys
  • ↩ = Enter

Editing

Code Completion (⌃ + Space)

Moving Lines (⌥ + ⌘ + [ and ⌥ + ⌘ + ])

Delete Entire Line (⌘ + D)

Comment Current Line / Block (⌘ + /)

Balance Indentation (⌃ + I)

Navigation

Going Back and Forth (⌃ + ⌘ + ← and ⌃ + ⌘ + →)

Jump to Definition (⌃ + ⌘ + J or ⌃ + ⌘ + Click)

Find Selected Symbol in Workspace (⇧ + ⌃ + ⌘ + F)

Find Call Hierarchy (⇧ + ⌃ + ⌘ + H)

Open Quickly (⇧ + ⌘ + O)

Jump to Line (⌘ + L)

Document Outline (⌃ + 6 or ⌘ + hovering the minimap)

Use ⌃ + 6 to drop down a menu from the Jump Bar (the area directly above the code editor) with all the symbols in the current source file. You can then navigate using the arrow keys, or by starting to type to filter the list of symbols. Useful not just for large files.

The minimap was a welcome addition to the Xcode editor in one of the recent releases of Xcode and provides a high-level visual overview of your code (Apple, if you’re reading this: can we please get a way to zoom the minimap, e.g. by dragging the divider?). When hovering over the minimap, it will display a flyout with the name of the symbol the mouse cursor is hovering over. Press ⌘ while hovering to see a list of all symbols.

View Management

Toggle Canvas / SwiftUI Preview (⌥ + ⌘ + ↩)

However, we don’t always need to see the preview, so it’s good to be able to toggle it as required. Use ⌥ + ⌘ + ↩ to hide or show the Canvas.

Toggle Views

  • Left: Navigator (⌘ + 0)
  • Right: Inspectors (⌘ + ⌥ + 0)
  • Bottom: Debug (⇧ + ⌘ + Y)

Summary

What are your favourite shortcuts? Let me know in the comments or share with me on Twitter!

Flawless iOS

🍏 Community around iOS development, mobile design, and marketing

Peter Friese

Written by

Google Developer Advocate with the Firebase team 🔥

Flawless iOS

🍏 Community around iOS development, mobile design, and marketing

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade