Favorite Xcode Shortcuts and Tips

Jesus Guerra
4 min readAug 19, 2022

--

That helped me to speed up my daily development

Photo by Sumeesh Nagisetty on Unsplash

One of the things I look up from other skilled developers is the ability to never leave the keyboard while coding.

Xcode has a lot of shortcuts, and I would like to share with you some of my favorite ones. I hope this helps you in the same way that it does for me to speed up my daily development.

But first, let’s make sense of Mac keyboard symbols

  • is the Command () key.
  • is the Control key.
  • is the Option (alt) key.
  • is the Shift key.
  • ↩ is the Return/Enter Key

Shortcuts

  • + . : Stop Xcode compiling or app running.
  • + + Y: Open/Close Debug Area
Control + Command + Y
  • + + E: Rename the variable in all its scope.
Control + Command + E
  • + + up/down arrow key OR holding down the and click-dragging the mouse: Multiline Edit
Shift + Control + ↓ (arrow down)
Hold Option and click-dragging the mouse
  • + + J: Jump to the bottom Filter Bar in the project navigator panel
Option + Command + J
  • + + O: Quick-Open, using a colon : after the file name will allow you to specify the file line.
  • Quick-Open in Side Editor: + + O followed fo + ↩

Tips

Swift Compiler Directives:

  • #error("message"): Compiler generates an error message and won’t let you compile
  • #warning("message"): Compiler generates a warning message.

Both are visible in the code editor and command line:

#warning and #error should not not used indiscriminately, be wise.

Xcode Annotations

  • MARK, MARK: - , TODO and FIXME: For better code section organization and segmentation.

Filter Search Bar

In the project navigation panel at the bottom, there is the Filter Search Bar. It has two buttons:

  • The Clock: If active, will show the file you have opened recently.
  • The Square(Source Control): If active, will show the files you have modified and not committed yet.

Watchpoints

This is a multi-step process but once you get used to it, it will be worth it.

  1. Add a regular breakpoint at the variable you want to watch
  2. Then run your app
  3. When the app stops due to the breakpoint in your variable move to the bottom Xcode’s debug area, to the left of the console.
  4. Look for your variable, right-click on it and select “Watch”.
  5. Remove the breakpoint you created in Step 1
  6. Continue with your program as normal

Once the above is done Xcode will pause right after the variable change value.

Conclusion

I really hope you benefit from this article and it helps you to increase your productivity and speed. One last tip, as odd as sounds, take it slowly select a few shortcuts and/or tips, and try to use them on a daily basis, once those become part of your muscle memory add a few more, and so on until you become a master of Xcode shortcuts :)

One of the best programming skills you can have is knowing when to walk away for a while.

— Oscar Godson

Thanks for reading. As usual, any feedback or comment is welcome. And If you desire to contribute to putting a smile on my face, please consider buying me a coffee/tea 🥺👉👈

--

--