Skip to content

lunij/SwiftFormatPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftFormatPlugin

A Swift Package Plugin for SwiftFormat.

It can run SwiftFormat as a pre-build command using the SwiftFormatPrebuildPlugin.

It can also run SwiftFormat as a command using either SwiftFormatCommandPlugin or the SwiftFormatRawCommandPlugin.

This package uses the official SwiftFormat binary. It does not fetch any source dependencies and does not require to compile SwiftFormat.

Usage

.package(url: "https://github.com/lunij/SwiftFormatPlugin", from: "x.y.z")
.target(
    name: "...",
    plugins: [
        .plugin(name: "SwiftFormatPrebuildPlugin", package: "SwiftFormatPlugin")
    ]
)

Terminal

swift package plugin --allow-writing-to-package-directory format-source-code    # SwiftFormatCommandPlugin
swift package plugin --allow-writing-to-package-directory swiftformat           # SwiftFormatRawCommandPlugin