Is there a way to make whitespace visible in the Xcode editor?

30,249

Solution 1

In Xcode 6.x and earlier:

View -> Text -> Show Spaces

View -> Text -> Show Control Characters

Solution 2

Editor -> Show Invisibles in Xcode 4

Solution 3

In Xcode 7 and later, this command has moved to the Editor menu:

Editor > Show Invisibles

or

Editor > Hide Invisible

Edit

As of Xcode 12.1, the menu item is now simply called "Invisibles". It's checked when invisibles are shown, and un-checked when they are not shown.

Further, it looks like Xcode now uses very light blue dots for spaces, and bold light blue dots for the spaces that correspond to your tab positions, which is very nice.

Solution 4

You can also use defaults to read/write to the Xcode plist

This is used/tested in Xcode 6.1

GUI

Editor->Show Invisibles

CLI

Turn it on

defaults write com.apple.dt.Xcode DVTTextShowInvisibleCharacters 1

Turn it off

defaults write com.apple.dt.Xcode DVTTextShowInvisibleCharacters 0

Solution 5

Since Xcode 11:

In the menu check/uncheck: Editor -> Invisibles

Share:
30,249
Admin
Author by

Admin

Updated on December 30, 2021

Comments

  • Admin
    Admin over 2 years

    I want the tabs and spaces to be visible in Xcode. Is this possible? I can't find it under preferences.