SwiftFormat is a code library and command-line tool for reformatting Swift code on macOS or Linux. SwiftFormat goes above and beyond what you might expect from a code formatter. In addition to adjusting white space, it can insert or remove implicit self, remove redundant parentheses, and correct many other deviations from the standard Swift idioms. Many programmers have a preferred style for formatting their code, and others seem entirely blind to the existing formatting conventions of a project. When collaborating on a project, it can be helpful to agree on a common coding style, but enforcing that manually is tedious and error-prone, and can lead to arguments if some participants take it more seriously than others. Having a tool to automatically enforce a common style eliminates those issues, and lets you focus on the behavior of the code, not its presentation.

Features

  • Use as a command-line tool that you run manually, or as part of some other toolchain
  • Use as a Source Editor Extension that you can invoke via the Editor > SwiftFormat menu within Xcode
  • Use as a build phase in your Xcode project, so that it runs every time you press Cmd-R or Cmd-B
  • Use as a Git pre-commit hook, so that it runs on any files you've changed before you check them in
  • Like the command-line tool, you can install the SwiftFormat for Xcode extension application via Homebrew
  • SwiftFormat's configuration is split between rules and options

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow SwiftFormat

SwiftFormat Web Site

You Might Also Like
La version gratuite d'Auth0 s'enrichit ! Icon
La version gratuite d'Auth0 s'enrichit !

Gratuit pour 25 000 utilisateurs avec intégration Okta illimitée : concentrez-vous sur le développement de vos applications.

Vous l'avez demandé, nous l'avons fait ! Les versions gratuite et payante d'Auth0 incluent des options qui vous permettent de développer, déployer et faire évoluer vos applications en toute sécurité. Utilisez Auth0 dès maintenant pour découvrir tous ses avantages.
Essayez Auth0 gratuitement
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of SwiftFormat!

Additional Project Details

Operating Systems

Linux, Mac

Programming Language

Swift

Related Categories

Swift Terminals, Swift Command Line Tools, Swift Code Formatters

Registered

2021-10-14