Swift Package Plugins - Getting Started

Shahrukh AlamShahrukh Alam
1 min read

Disclaimer

This article doesn’t explain what is a Swift Package Plugin, but just provides Source Code of the demos discussed in the related WWDC videos.

I hope you will have better resources to start diving into Swift Package Plugin, next time we will understand in detail what it is, how it works & where we can use it.


Meet Swift Package plugins

In this WWDC video, @Anders Bertelrud walks us through the basics of Plugins. But, it doesn’t show the code as he used the remote Package dependencies.

I tried to search for the packages used, had some luck to find related code examples from @Anders Bertelrud’s repos. Forked them to keep a record in case upstream is deleted.


Note

These repos are not updated & might not work. But, they might be a good starting point to learn about Plugin & what it can do.


Create Swift Package plugins

In this WWDC video, @Boris Bugling actually creates the Plugins, you can find the snippets in the video link, but the complete code is not downloadable. So, I have created working swift packages for you.

Command Plugin

GenerateContributors

Build Tools Plugin

In-build Command

IconLibrary

Pre-build Command

Genstrings

0
Subscribe to my newsletter

Read articles from Shahrukh Alam directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shahrukh Alam
Shahrukh Alam