Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I get rid of trailing space in XCode?

The best and easy way without using scripts, hacks and much more. Just go to Find And Replace and press alt/option + space and press space button in the replace bar and then click on replace all. It will replace the whitespaces with normal spaces and the warning/ error will be gone !!

How do I see tabs in XCode?

XCode 4 now supports tabs. You can enable by selecting "View / Show Tab Bar" menu. You can set custom keyboard shortcut to rotate between tabs in "Preferences / Key Bindings / Select Next Tab" option.


Editor -> Show Invisibles in Xcode 4


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 simple "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.


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

Since Xcode 11:

In the menu check/uncheck: Editor -> Invisibles


In Xcode 6.x and earlier:

View -> Text -> Show Spaces

View -> Text -> Show Control Characters


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:

Demo