Showing spaces and tabs in Xcode 4

A problem that I have been running into a lot while working with Xcode 4, Git and team mates is trailing whitespace. For some reason Xcode purely sucks at adding whitespace, causing team mates to see edits during code reviews. My team uses Reitveld for code review, and making that experience any less sucktastic is worth some effort.

A quick way that I found to show spaces and tabs in Xcode 4, before you commit, etc., is to use the Show Invisibles feature.

 

 

 

 

This will toggle your code view from normal, to showing tabs and spaces visually.

 

I also mapped this feature to Command+9 so I could quickly switch between showing and hiding invisibles.

  • Randall

    On my system tabs and newlines are still invisible, though spaces are clearly represented by that U-shaped glyph. Is there a way to make those visible?

  • Anonymous

    Have you tried showing invisibles and then adding a tab? I can see tabs when I do that. If you use git, I can drop a post on a “git post commit hook” that will clear out all whitespace on each commit. We also use a build phase script that will clean it up, but I prefer the post commit hook…