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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
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