Unlocking Productivity: The Ultimate Guide to Xcode Keyboard Shortcuts

In the world of iOS and macOS development, Xcode is the powerhouse tool that developers rely on daily. While Xcode is packed with features, mastering its keyboard shortcuts can significantly boost your productivity. Here’s a comprehensive guide to some of the best Xcode shortcuts, along with a nifty trick on how to customize them to fit your workflow.

Essential Xcode Shortcuts
Navigation:
Cmd + Shift + O: Open Quickly – This is your go-to for opening any file in your project instantly.
Cmd + 0: Show/Hide the Navigator – Toggle the left sidebar on and off.
Cmd + 1 to Cmd + 9: Switch between different Navigator sections (Project, Source Control, Debug, etc.).

Editing:
Cmd + /: Comment/Uncomment the selected line or block of code.
Cmd + D: Duplicate the current line or selection.
Control + /: Indent or un-indent the current line or selection.
Option + Delete: Delete the word to the left of the cursor.

Code Completion and Navigation:
Esc: Complete the current word or show code completion suggestions.
Cmd + Click: Jump to the definition of a symbol or open the Quick Help for it.
Control + 6: Jump to the previous issue or warning in the Issue Navigator.

Debugging:
Cmd + Y: Show or hide the Debug Area.
Cmd + Shift + Y: Show or hide the Debug Area and the Navigator at the same time.
Cmd + Option + I: Show the Debug Navigator.

Customizing Your Shortcuts
One of the lesser-known features of Xcode is its ability to customize keyboard shortcuts. This can be particularly useful if you find yourself frequently performing a specific action or if you’re switching from another IDE with different shortcuts.

How to Create Custom Shortcuts:
Open Preferences: Go to Xcode > Preferences > Key Bindings.
Find Your Command: Use the search bar at the top to find the command you want to customize. For instance, if you want to delete the current line, you might search for “Delete to End of Line” or “Delete Line”.
Assign a New Shortcut: Click in the field next to the command and press your desired key combination. For example, Shift + Control + Option + Command + L could be set to delete the current line, as you’ve done.

Tips for Customization:
Avoid Conflicts: Make sure your custom shortcut doesn’t conflict with existing Xcode or system shortcuts.
Consistency: Try to keep your shortcuts consistent with other tools you use to avoid confusion.
Document Your Changes: Keep a note of your custom shortcuts, especially if they’re complex, to save time in remembering them.

Conclusion
Mastering Xcode’s keyboard shortcuts is like learning a new language that speaks directly to your productivity. By integrating these shortcuts into your daily workflow, you’ll find that tasks that once took several clicks now take just a moment. And by customizing your shortcuts, you tailor Xcode to your unique coding style, making your development environment not just a tool, but an extension of your thought process. Whether you’re a seasoned developer or just starting out, these shortcuts will help you code smarter, not harder. Happy Xcoding!

Automate your Xcode workflow / Dev tools with keyboard shortcuts

Hardware

As developers, we start and switch a lot between common developer applications each day. You can buy some external hardware keyboards to achieve this, like for example with these USB Mini 3-Key Keypad, or the HUION Keydial, 9-Keys USB Mini Keypad, Programming Macro Pad. They work fine but you must always pack them in your bag when going to your workspace, but make sure before purchasing them, that they have macOS software drivers.

macOS Shortcuts

Personally I have the Huion, and use it for general Xcode keyboard shortcuts — like show / hide panes, delete current line, Run, Stop, etc, and to save keys I use macOS Shortcuts to launch applications like Xcode.

To achieve this do the following:

  1. open Shortcuts
  2. tap on the + in the title bar
  3. In the categories tab on the right, select Open App, and drag it on the canvas
  4. Click on App, to select Xcode
  5. Click on the info circle top right > Add keyboard shortcut > Control+Option+Command+x
  6. If you see on the canvas, Receive input from, deselect all
  7. Tap on the default name in the title: Open App, to change it to Open Xcode, and you can optionally assign an icon, but this is not really needed.
  8. Now comes the confusing part, there is no save, you just close this window with the red x
  9. Close Shortcuts
  10. Test by tapping Control+Option+Command+x

Other Dev tools

Now you can repeat this process for your most common developer tools like SourceTree, Interactful, Slack, enjoy!

Xcode tip – rename

When you start developing an app, you don’t often know yet what the real name of your app will be, even you think you know. What do I mean by that?

Well, say you call your app TrainSleeper. You create the new app like this in Xcode and all is fine. Once you create the app in App Store Connect, it might shout at you that someone else owns this name and you cannot use it. You start searching for an app with this name in the store to see it, but it does not exist. This is because you can add an app with a certain name but never publish it. That name stays locked to the person who did this.

Anyway we need a lot of renaming during each development cycle, there is nothing to be ashamed about, it’s a very common task.

For this reason I added a keyboard shortcut to rename.

Give the rename menu function a shortcut.

Go to Settings with CMD + ,

Go to the Key Bindings tab

In filter type rename

In the key column after the rename word press all the keys you want, I selected;

SHIFT + CONTROL + OPTION + COMMAND + R

Why so many keys? Well Xcode has many shortcuts, this avoids conflict with other shortcuts