Swift Package (Command) Plugin to format source code with nicklockwood/SwiftFormat

Last update: Aug 4, 2022

SwiftFormatPlugin

A Swift Package Plugin to format source code with SwiftFormat.

Add to Package

Add the package to your dependencies.

dependencies: [
    // ...
    .package(url: "https://github.com/MarcoEidinger/SwiftFormatPlugin", from: "0.49.12"),
]

Note: the version matches a SwiftFormat release.

Run Plugin

SPM

swift package plugin --allow-writing-to-package-directory format-source-code

You can limit the formatting to a particular target with --target option.

You can also specify SwiftFormat arguments such as --swiftversion.

Example

swift package plugin --allow-writing-to-package-directory format-source-code --target MyLibrary --swiftversion 5.6 --verbose

Xcode

In Xcode 14 you can trigger the command plugin execution for a Swift package or an Xcode project.

For an Xcode project the project's main directory will be processed and the --target option will be ignored.

You can also specify SwiftFormat arguments such as --swiftversion.

Run plugin in Xcode 14

GitHub

https://github.com/MarcoEidinger/SwiftFormatPlugin
You might also like...

iOS command-line tool that allows searching and downloading ipa files from the iOS App Store

ipatool for iOS This is a port of Majd Alfhaily's ipatool adapted to run on iOS Build / Installation To build this, make sure you have AppSync install

Jun 16, 2022

A nifty command-line tool to customize macOS icons

iconset A nifty command line tool to manage macOS icons iconset is a new command line tool for macOS that allows you to change icons for macOS apps (e

Jun 25, 2022

🕳 A simple command line tool to punch hole to reduce disk usage on APFS volume for such as a raw disk image.

HolePunch NAME holepunch -- A simple command line tool to punch hole to reduce disk usage on APFS volume for such as a raw disk image. SYNOPSIS holepu

Jun 10, 2022

The best command-line tool to install and switch between multiple versions of Xcode.

The best command-line tool to install and switch between multiple versions of Xcode.

The best command-line tool to install and switch between multiple versions of Xcode.

Aug 6, 2022

Command Line Tool for interacting with MachO binaries on OSX/iOS

inject inject is a tool which interfaces with MachO binaries in order to insert load commands. Below is its help. ➜ ./inject -h OVERVIEW: inject v1.0.

Jul 12, 2022

ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file.

Synopsis ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file. Motivation It should be possible to read .ips file

Jul 29, 2022

CookCLI is provided as a command-line tool to make Cook recipe management easier

CookCLI is provided as a command-line tool to make Cook recipe management easier, and enable automation and scripting workflows for the CookLa

Aug 9, 2022

Adjust the volume from the command line on macOS.

volume Adjust the volume from the command line on macOS. Installation Using Mint: mint install meowmeowmeowcat/[email protected] Usage USAGE: volume numb

Apr 21, 2022

A Mac command-line tool that automatically downloads macOS Installers / Firmwares.

A Mac command-line tool that automatically downloads macOS Installers / Firmwares.

MIST - macOS Installer Super Tool A Mac command-line tool that automatically downloads macOS Installers / Firmwares: Features List all available macOS

Jul 31, 2022
Comments
  • 1. Plugin fails when space in path to root directory

    Unclear to me currently why, though I'm trying to do a bit more digging but I can run the plugin fine and it says it's passed but it isn't actually formatting the files.

    I've run swiftformat . from the root of the project and it works as expected and the files are reformatted.

    I've tried adding the --verbose flag, but this is just crashing Xcode for me 😅

    Haven't yet tried via command line.

    Reviewed by Sherlouk at 2022-08-01 18:42
Generate Markdown documentation from source code
Generate Markdown documentation from source code

SourceDocs SourceDocs is a command line tool that generates markdown documentation files from inline source code comments. Similar to Sphinx or Jazzy,

Jul 27, 2022
Swift-cli - Example of building command-line tools in Swift
Swift-cli - Example of building command-line tools in Swift

swift-cli Example of building command-line tools in Swift Step 1: Create CLI wit

Jan 17, 2022
Compose beautiful command line interfaces in Swift
Compose beautiful command line interfaces in Swift

Commander is a small Swift framework allowing you to craft beautiful command line interfaces in a composable way. Usage Simple Hello World i

Aug 9, 2022
CommandLineKit - A pure Swift library for creating command-line interfaces

CommandLineKit A pure Swift library for creating command-line interfaces. Note: This project is no longer maintained. It's preserved here for historic

Jul 23, 2022
Simple & Elegant Command Line Interfaces in Swift
Simple & Elegant Command Line Interfaces in Swift

An elegant pure Swift library for building command line applications. Features Tons of class, but no classes. 100% organic pure value types. Auto gene

Jul 21, 2022
Command line utility to profile compilation time of Swift project.
Command line utility to profile compilation time of Swift project.

xcprofiler Command line utility to profile compilation time of Swift project. This tool is developed in working time for Cookpad. Installation gem ins

May 18, 2022
Josephus - A command line tool to solve Josephus problem in Swift
Josephus - A command line tool to solve Josephus problem in Swift

josephus A command line tool to solve Josephus problem in Swift

Jan 25, 2022
Simple & Elegant Command Line Interfaces in Swift
Simple & Elegant Command Line Interfaces in Swift

An elegant pure Swift library for building command line applications. Features Tons of class, but no classes. 100% organic pure value types. Auto gene

Jul 21, 2022
Swiftline is a set of tools to help you create command line applications
Swiftline is a set of tools to help you create command line applications

Swiftline is a set of tools to help you create command line applications. Swiftline is inspired by highline Swiftline contains the following: Colorize

Aug 6, 2022
A Mac command-line tool that generates kick-ass Jamf Pro reports.
A Mac command-line tool that generates kick-ass Jamf Pro reports.

KMART - Kick-Ass Mac Admin Reporting Tool A command-line utility generating kick-ass Jamf Pro reports: Features Reporting on the following Jamf Pro ob

Aug 2, 2022