- SwiftFormat
- Runs SwiftFormat when Swift files are saved.
- 323 Installs
-
This extension is allowed to:
- Read Files
- Launch Subprocesses
Readme
SwiftFormat integrates Nick Lockwood's SwiftFormat with Nova.
This extension will run the formatter when a Swift document is saved. It can also be invoked as an editor command.
Requirements
The SwiftFormat extension includes a built-in version of the actual formatter tool, so no additional setup is required.
If you would like to use a different version, you can set a path to a custom binary in settings. You might do this if you work on a team and want to ensure that everyone is using a particular version.
Usage
SwiftFormat runs any time a Swift document is saved in Nova, automatically reformatting code according to the default SwiftFormat rules. You can customize the rules by creating a .swiftformat
config file in the root of your project.
To run SwiftFormat manually:
- Select the Editor → SwiftFormat menu item; or
- Open the command palette and type
SwiftFormat
Configuration
To configure global settings, open Extensions → Extension Library... then select SwiftFormat's Settings tab.
You can also configure settings on a per-project basis in Project → Project Settings...
Contributing and Collaboration
I'd love to hear from you! Get in touch via mastodon, an issue, or a pull request.
By participating in this project you agree to abide by the Contributor Code of Conduct.
Changelog
Version 1.0.3
- Bumped the bundled SwiftFormat version to 0.52.10
Version 1.0.2
- Fixes an issue where the formatter would error if there was a newline in
.swift-version
. Thanks for reporting @hisaac! - Removes a misleading placeholder from the swift version setting.
Version 1.0.1
- Bumps the bundled SwiftFormat version to 0.52.4
Version 1.0
Initial release 🥰
- Includes bundled SwiftFormat version: 0.52.3