Code Formatters#

Noctule provides a native code formatter and also integrates with the popular swiftformat by Nick Lockwood and swift format, which ships with Swift 6 and later.

Formatting Swift Sources#

Native Formatter#

The formatting inside the editor is handled by Noctule’s native, built-in formatter.

Settings for the built-in formatter can be found at Preferences → Editor → Code Style → Swift (Noctule).

This formatter is needed to provide a good editor experience. It handles indentation, reformatting after refactorings, and more. But it’s not yet as powerful as the other formatters.

If you rely on an external formatter, we recommend using “Format on Save”.

If you prefer to use an external formatter in the editor for Code → Reformat Code, please open a feature request on GitHub.

External Formatters#

Paid feature

Noctule supports running external formatters when you save a Swift file.

You can configure the settings at Preferences → Languages & Frameworks → Swift (Noctule). Two different formatter commands are supported: swiftformat and swift format of the Swift toolchain.

The “On Save” actions of your IDE are configured at Preferences → Tools → Actions on Save. The settings there are exactly the same as those on Noctule’s configuration page linked above.

The supported formatters are documented on their own pages:

Formatting Objective-C Sources#

Paid feature

Native Formatter#

Noctule provides a native formatter for Objective-C files.

Settings for the built-in formatter can be found at Preferences → Editor → Code Style → Objective-C / C (Noctule).