2

With the release of Xcode 16 apple added support for EditorConfig:

Added support for EditorConfig. The editor now respects indentation settings given in .editorconfig files. Xcode supports the following settings: indent_style, tab_width, indent_size, end_of_line, insert_final_newline, max_line_length, and trim_trailing_whitespace. See https://editorconfig.org for more information. Settings from .editorconfig files normally take precedence over settings given in the “Text Editing” section of View > Inspectors > File for a file or group. This can be disabled by unchecking the “Prefer Settings from EditorConfig” checkbox on the Indentation tab of Xcode > Settings > Text Editing. (20796230)

In my project I create a new .editorconfig file under root directory:

# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

[*.swift]
indent_style = space
indent_size = 4

[*.{h, m, mm}]
indent_style = space
indent_size = 4

[*.metal]
indent_style = space
indent_size = 4

However, when I try to re-indent, it's not working

0

1 Answer 1

1

Turns out it's a known issue:

Changes to .editorconfig are not reflected immediately in open files. (120389049)

Workaround: Quit and restart Xcode.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.