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

Automatic Formatting with apple/swift-format #90

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

Conversation

ashvardanian
Copy link
Contributor

When working with the repository, I am not always sure about how to style code, as Swift gives a lot of flexibility on where to put public clauses, how to indent the code and so on. Moreover, Xcode isn't friendly to "Format on Save". Luckily, there is a swift-format utility from Apple, that works very similar to clang-format.

We extensively use such systems in our codebases. They help keep the code sane when the number of contributors rises. If interested, you may want to add it to your Git hooks.

@johnmai-dev
Copy link
Contributor

Nice! I've been waiting.

@pcuenca
Copy link
Member

pcuenca commented Apr 12, 2024

Thank you, this was surely needed! I'll review in depth soon. Would you say that the rules you chose are more or less standard across Swift codebases, or are there other alternatives? (I personally don't like to break up all function parameters in multiple lines, but willing to sacrifice for consistency).

@ashvardanian
Copy link
Contributor Author

Not sure the standard exists in Swift. I'm now enabling these rules in the libraries I maintain - UForm, USearch, StringZilla. Maybe with enough popular libraries agreeing on the format, we can propose that missing standard 🤷‍♂️

@johnmai-dev
Copy link
Contributor

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.

3 participants