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

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
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