Knowing the Xcode shortcuts would improve your speed and boost your productivity. Today, we will be discussing some of the commonly used shortcuts.
- ⌘ – Command
- ⇧ – Shift
- ⌥ – Option/Alt
- ⌃ – Control
- ⇠⇢ – Left/Right Arrow Keys
- ⇡⇣ – Up/Down Arrow Keys
- ⏎ – Return
- ⇥ – Tab
- ⎋ – Escape
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:
Hide/Show Navigation Area :⌘ + 0
Hide/Show Debugging Area : ⌘+⇧+Y
Hide/Show Utility Area : ⌘+⌥+ 0
Navigation through Inspector Area Tabs: ⌘1…8
Navigation through Utilities Area Tabs: ⌘1…6
Open quickly: ⇧+⌘+O
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:
To comment or uncomment use : ⌘ + /
Search within a file: ⌃+6
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 ⌥+⌘+⇠
Reorder statements : ⌥+⌘ + [ ]
Use command and option along with the right and left brackets to move the statement above/below the adjacent statements.
Indent Code : ⌘ + [ ]
This shortcut is used to indent the whole code left/right
Add and Remove breakpoints : ⌘ + \
To enable/disable all breakpoints use ⌘ + Y
That’s a wrap on this tutorial demonstrating Xcode Shortcuts. Stay tuned for updates!