Thursday, August 29, 2024

EditorConfig Files in Xcode

Pol Piella:

As a developer for Apple platforms, you probably work on multiple projects with different coding styles and conventions and have to find yourself adjusting Xcode’s editor settings every time you switch between projects. This can be a tedious process that you might forget to do or overlook and, if the project does not have a linter that enforces the coding style, you might end up with inconsistent code formatting across the codebase.

Thankfully Xcode 16 adds support for EditorConfig files, which allows you to define Xcode editor settings in a programmatic way on a per-project basis. In this article, you will learn how to set up EditorConfig files in Xcode and what settings are supported at this time.

They also work in BBEdit.

Previously:

5 Comments RSS · Twitter · Mastodon


I find it ironic that basically every code editor I've used in the last 5+ years has supported EditorConfig either natively or with a simple plugin and most of those are free and not supported by a gigantic corporation, and Apple is just adding it now.


@gildarts: It's not surprising, though, because EditorConfig is a common standard, and not something Apple invented themselves.


@Doodpants: Yeah, I didn't say it was surprising for a reason. :)


Is there any tie-in with clang-format?


> find yourself adjusting Xcode’s editor settings every time you switch between projects
Well, you don't have to do that. Xcode does support per project (even per file) indentation settings since like forever.

I think this is a general misunderstanding of the feature, it didn't happen because of a desire for interoperability. The feature (IMO) was added because SPM projects lack an xcproj and hence the ability to specify the indentation settings.
It is nice that they've chosen to use a standard to support such for SPM.

Leave a Comment