Using Xcode the right way is as important as sitting on a comfortable chair to endure long hours of coding. This is my personal note to remind me on what to do when I need to do a fresh Xcode install, and its shortcut.

Get rid of those trailing whitespace

Method 1: Xcode preferences

This is best described by John Sundell’s tweet on why you should enable this option. Very useful if you need to entertain linting tools such as SwiftLint or Codacy.

Method 2: command line

However, if by chance, I forgot to check this option, here’s the magic line that should clean up thos extras, effortlessly. From the root source directory: find . -name '*.swift' | xargs -I{} sed -i '' 's/[[:space:]]*$//g' {}. Be sure to commit everything first before running that!

Source: here

Method 3: git

I haven’t actually tested this but another tweet reply recommends to add the following configurations in ~/.gitconfig:

    whitespace = trailing-space,space-before-tab
    whitespace = fix

Make your eyes comfortable

Todate, my favorite Xcode theme is still this WWDC17, which you can download from here

My favorite Xcode shortcuts

Shortcuts are habit that needs to be developed as I need to be faster.

  1. ⌘ + Shift + O and start typing the file or function or class name. No doubt, this is faster than browsing through the Project Navigator especially for big projects.
  2. ⌘ + Shift + J will immediately focus the file that you’re editing on the Project Navigator. Very useful because usually view controller and view model are close to each other
  3. ⌘ + Shift + 0 to hide the entire Inspector on the right
  4. ⌘ + 0 to hide the entire Navigator on the left
  5. ⌘ + Shift + Y to hide the entire Debugging, bottom area
  6. ⌘ + Shift + F to start searching any text across files
  7. Control + 6 and start typing any function or variable name and it will point you right where it is. This is very useful for a long file! plus, it makes you look pro haha
  8. ⌘ + r , obviously to run the project
  9. ⌘ + Shift + option + K, to super clean the project or clear derived data (cleaner than ⌘ + Shift + K)
  10. ⌘ + b , the fastest way to build the project
  11. ⌘ + . , the fastest way to stop any runs
  12. Add shortcut dd to delete line from Xcode’s keyboard binding