# SwiftFormatPlugin

In this blog post I will introduce my new, open-source Swift Package Plugin [`SwiftFormatPlugin`](https://github.com/MarcoEidinger/SwiftFormatPlugin) that you can use to format source code belonging to your Swift Package or Xcode Project. The plugin is leveraging the popular [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) open-source project.

SwiftFormat made it easy to create such a [package plugin](https://github.com/apple/swift-evolution/blob/main/proposals/0303-swiftpm-extensible-build-tools.md) by publishing an [artifact bundle](https://github.com/apple/swift-evolution/blob/main/proposals/0305-swiftpm-binary-target-improvements.md) starting with their GitHub release [0.49.12](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.49.12). 

<img width="890" alt="Screen Shot 2022-07-15 at 3 42 24 PM" src="https://user-images.githubusercontent.com/4176826/179321119-0ddd3334-8d91-439a-be0a-3cb2c440370d.png">

Once you added my package you can trigger source code formatting from the CLI or from Xcode 14 directly.

- Swift Packages
- Xcode projects

![Run plugin in Xcode 14](https://user-images.githubusercontent.com/4176826/179352584-db7f7f42-452c-4a42-a329-01b115a237a7.gif)

You find more information in the plugin's [README](https://github.com/MarcoEidinger/SwiftFormatPlugin/blob/main/README.md).

%[https://github.com/MarcoEidinger/SwiftFormatPlugin]
