It sounds like maybe your editor is using tabs rather than spaces? Or perhaps it’s using spaces, but it realizes that you’ve deliberately indented it for coding reasons and it’s assuming you want to outdent rather than have code indented 3 spaces?
Speculation, and perhaps you’re already aware of this.
In Xcode the indentation can be set to prefer spacers or tabs. And the indent width can also be set to N spaces. So, it indentation was set to prefer tabs, and the tab width is set to 4 spaces, then when you backspace it will remover the tab.
Like in many other IDEs and text editors, if you press the Delete key at the beginning of the line indented with spaces, it deletes not just a single space, but the number of spaces corresponding to a single indentation level.
That is, pressing the Delete key at the beginning of indented line simply un-indents that line, which means that in such a case it works the same as if you have pressed Command-[.
In Sublime Text, for example, it can be turned off by using the following setting:
"use_tab_stops": false
I’m looking how to turn this off in Xcode.
That is, when I press Command-], it should add 4 spaces. And when I press Command-[, it should remove 4 spaces. But when I press Delete at the beginning of the indented line, it should remove 1 space, not 4.