Is there a way to make whitespace visible in the Xcode editor?
XcodeEditorWhitespaceXcode Problem Overview
I want the tabs and spaces to be visible in Xcode. Is this possible? I can't find it under preferences.
Xcode Solutions
Solution 1 - Xcode
Editor -> Show Invisibles in Xcode 4
Solution 2 - Xcode
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 3 - Xcode
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 4 - Xcode
Since Xcode 11
:
In the menu check/uncheck:
Editor -> Invisibles
Solution 5 - Xcode
It is under Editor -> Invisibles. You can check it to show or uncheck it to hide them.
A note about the macOS
In the mac environment, you can search for any menu option under the Help menu, then it will open the exact menu path you are looking for. For example, searching for invisibles results in this:
Solution 6 - Xcode
In Xcode 6.x and earlier:
View -> Text -> Show Spaces
View -> Text -> Show Control Characters
Solution 7 - Xcode
You can also enter a white space into the search field, this will highlight all white spaces in yellow temporarily. I found this accidentally here, where Marty asked the other way around: https://stackoverflow.com/questions/23638320/what-are-these-yellow-spacers-in-xcode