Practically very useful and huge time-saver shortcuts on Xcode

Xcode Shortcuts Feb 20, 2021 · 2 min read

You can find a lot of cheatsheets about shortcuts on Xcode out there on the Internet and you can ask "Why do I ever need another one?". I think the problem with most of them is that they include a lot more shortcuts than you ever need while you develop apps on Xcode. For me, it was always difficult to memorize them because I did it in the wrong way. The rule of thumb is to memorize only the frequently used ones that are hidden and hard or time-consuming to find on Xcode because they require several steps to be made. Use Help on Xcode to find and use other less frequently used commands. Here is the list of all shortcuts I use on a daily basis that I really recommend memorizing to boost your productivity at work. I think and believe that most of them overlap with your favorite shortcuts.

Building and running

  • Build a project - Command + B
  • Run a project - Command + R
  • Stop building or running a project while it is building or running - Command + .
  • Run tests in a project - Command + U
  • Run only unit tests in a project - Command + Shift + U
  • Clean a project - Command + Shift + K

Documentation

  • Generate documentation for code - Command + Option + /

Editing

  • Comment or uncomment code - Command + /
  • Show actions to take on code - Command + Click
  • Edit code definition and all its usages - Command + Control + E
  • Fix code indentation - Control + I
  • Indent code - Tab
  • Outdent code - Shift + Tab
  • Fold a section - Command + Option + Left
  • Unfold a section - Command + Option + Right
  • Move code
    • Up - Command + Option + {
    • Down - Command + Option + }
  • Select
    • Code in a file - Command + A
    • Code in a rectangular area Option + Click + Drag
    • Code from the cursor - Shift + Click
      • To the beginning of code - Command + Shift + Left
      • To the end of code - Command + Shift + Right
      • To the top of a file - Command + Shift + Up
      • To the bottom of a file - Command + Shift + Down

Navigation

  • Open quickly a file, class, function, etc - Command + Shift + O
  • Locate the currently opened file in the Project Navigator - Command + Shift + J
  • Jump to a line in a file - Command + L
  • Open the Documentation library - Command + Shift + 0
  • Show the Code Snippets library - Command + Shift + L
  • Open a tab in the Project Navigator - Command + 1, 2, 3, etc
  • Toggle
    • The Project Navigator - Command + 0
    • The Inspectors - Command + Option + 0
    • The Debug area - Command + Shift + Y
  • Move the cursor to
    • The beginning of a line of code - Command + Left
    • The end of a line of code - Command + Right
    • The top of a file - Command + Up
    • The bottom of a file - Command + Down

Search

  • Find in a file - Command + F
  • Find and replace in a file - Command + Option + F
  • Find in a project - Command + Shift + F
  • Find and replace in a project - Command + Option + Shift + F

Tabs

  • Open a new tab - Command + T
  • Jump to the previous tab from right to left - Command + Shift + {
  • Jump to the next tab from left to right - Command + Shift + }