Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swift-format config #595

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samdeane
Copy link
Contributor

Adds a .swift-format file to the root of the project.

If swift-format is used to format any files, it will pick up these settings.

Note that this won't magically cause all files to be formatted, and I've not run the formatter over them.

Having this file here just means that if someone does run swift-format, it will do something consistent and not use whatever their default settings are.

The actual settings we might want to settle on are of course up for grabs. I've picked some that are pretty close to Apple's defaults, but not identical.

you might want to use different settings for this!
@migueldeicaza
Copy link
Owner

Question, does Xcode follow those settings, or is that more of a user-level choice?

@samdeane
Copy link
Contributor Author

I think the latest Xcode has support for running swift-format, and I believe that it would respect the settings in the file if it's there, but I haven't tried it. I will experiment a bit!

@samdeane
Copy link
Contributor Author

samdeane commented Dec 10, 2024

I've tested this.

Xcode does honour the settings in the file, but only if you explicitly format a source file using Ctrl-Shift-I (Editor/Structure/Format File With swift-format)

image

So currently this change won't affect anyone who doesn't opt in, but it will set a baseline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants