Xcode Text Editing Settings

Use the below settings and I won't have to fight with weird indentation or spacings ^^

Under Editing, be sure to tick Including whitespace-only lines. It will make Xcode trim white spaces along the empty lines.

Under Indentation, Prefer Indent Using Spaces. Ensure that the Tab Key should Indents in leading whitespace