Last week I released a maintenance update for my Stream Deck plugin library. The update was mainly to address an issue someone found with switching to embedded profiles, where I'd left myself a TODO which I never got around to doing. While working on the code I also decided to add some new plugin packaging features.

The binaries the library produces have always included a command line interface for generating the plugin manifest and copying the binary to help build the final plugin bundle. This release adds new commands for copying resource files and linking the binary for debugging.

Linking the Binary

The Stream Deck app always loads plugins from its own Library folder, which means the binary needs to be in that folder. In my own plugin development I wrote shell scripts which would link the plugin binary from either the Swift Package or Xcode's derived data folder, but it's a common enough task I wanted to add proper support.

Joining --copy-executable is --link-executable, which does what it says on the tin: the current binary will be linked into the destination folder. Now simply building the project means the next run of the plugin will use the fresh build.

Bundling Resources

The plugin binary is only half of a plugin, static resources make up the visual half. There are two commands for copying resources into a plugin folder.

The first, and simplest is --copy-file, which simply copies a file or folder into the target folder. For folders the contents are copied and the structure preserved.

The second is --copy-resource, which copies files from the package module. If your Swift package (or any of its dependancies) define package resources, accessible from Bundle.module, this command will copy those files so the plugin binary can access them.

The Counter

Finally the example plugin, a basic counter, has beed updated to demonstrate many more library features. It now has an action which, appropriate for the release, changes to profile. Using action Settings with a property inspector is also shown in an action which sets the counter.

The update is available wherever you get your Swift Packages.