Xcode 4.5 - trailing spaces

The latest version of Xcode (4.5) should separate whitespace from source files.

But when I save the file with some spaces at the end of the line, they are still there.

What am I missing?

+6
source share
3 answers

OK, that’s the problem.

Xcode will not trim the space in the space if you add a space at the end of a line, leave the cursor at the end of that line, and then save it.

You need to move the cursor from this line and then save it.

Could there be some conflict between keeping the cursor position while trimming the spaces?

+7
source

Yes, writing Xcode editable code shows trailing spaces in Git. Going to the Xcode settings> Text Editing: Editing (tab), you can include lines only for spaces. enter image description here

Worth mentioning my current version of Xcode v5.1.

Now, what about code that is already loaded in git that complains about spaces?

Well, find 4 spaces in your editor (by default, in the Xcode settings> Text Editing> Indentation, indentation with four spaces, which can also be changed); and replace the empty line manually for those who do not have code in the line. You can also copy the paste code into another editor (for example, TextWrangler) to see if there is an empty line with only 4 spaces. "Cmd + G" is a short key to "find the next", helps with repetition.

+3
source

Starting with Xcode 4.4, spaces will be automatically trimmed (by default). I recommend also activating the inclusion of lines with spaces.

Go to Xcode> Settings> Text Editing> When Editing

+1
source

Source: https://habr.com/ru/post/926521/


All Articles