Knowing the Xcode shortcuts would improve your speed and boost your productivity. Today, we will be discussing some of the commonly used shortcuts.
Refer to this legend for symbols of each button:
- ⌘ – Command
- ⇧ – Shift
- ⌥ – Option/Alt
- ⌃ – Control
- ⇠⇢ – Left/Right Arrow Keys
- ⇡⇣ – Up/Down Arrow Keys
- ⏎ – Return
- ⇥ – Tab
- ⎋ – Escape
Basic Shortcuts
Here’s a list of a few basic shortcuts that we all need to know:
- Build: ⌘B
- Run: ⌘R
- Test: ⌘U
- Stop: ⌘.
⌘ + K is used to do a basic clean
⇧ + ⌘ + K is used to do a complete clean of all build files. This is used when your environment starts to behave weirdly
Let’s next look at some Workspace Shortcuts:
Workspace Shortcuts
Hide/Show Navigation Area :⌘ + 0
Xcode Workspace Shortcut Navigation
Hide/Show Debugging Area : ⌘+⇧+Y
Xcode Workspace Shortcut Debugging Area
Hide/Show Utility Area : ⌘+⌥+ 0
Xcode Workspace Shortcut Utility
Navigation through Inspector Area Tabs: ⌘1…8
Xcode Inspector Tabs Shortcut
Navigation through Utilities Area Tabs: ⌘1…6
Xcode Utilities Tabs Shortcut
Open quickly: ⇧+⌘+O
Xcode Shortcut Open Quickly
Assistance Editor
This can be accessed using the two circles at the top right.
Commands to show and hide are:
Show – ⌘ +⌥ + ⏎
Hide – ⌘ + ⏎
Auto-documentation : ⌘ +⌥ + /
We can add comments over a method in documentation formatting as shown below:
Xcode Shortcut Auto Documentation
To comment or uncomment use : ⌘ + /
Search within a file: ⌃+6
Xcode Shortcut Search In File
Edit/Rename all in Scope : ⌃+⌘+E
This shortcut is used to change a variable/method name in the file.
Fix all errors : ^+⌥+⌘+F
Instead of manually fixing each error from the right side error labels, the above command fixes all errors that can be resolved automatically.
Hide/Expand class or method body : ⌥+⌘+⇢ OR ⌥+⌘+⇠
Xcode Shortcut Hide Expand Function
Reorder statements : ⌥+⌘ + [ ]
Use command and option along with the right and left brackets to move the statement above/below the adjacent statements.
Xcode Shortcut Reorder Statements
Indent Code : ⌘ + [ ]
This shortcut is used to indent the whole code left/right
Xcode Shortcut Indent Statements
Debugging Shortcuts
Add and Remove breakpoints : ⌘ +
Xcode Shortcut Add Remove Breakpoint
To enable/disable all breakpoints use ⌘ + Y
That’s a wrap on this tutorial demonstrating Xcode Shortcuts. Stay tuned for updates!