Generating Code and Other Mischief with Swift Package Manager Plugins
summary
Swift Package Manager adds two concrete extension types: command plugins that run on demand and can ask permission to write into the package, and build tool plugins that run every build and must write outputs into a sandbox (often the derived data sandbox). The architecture separates a tiny plugin that emits build commands from an executable that does the work, passing a Codable payload; examples include a working dated image generator that writes generated Swift into derived data and a prank do_nil_disturb plugin that injects build-failing errors on holidays. Major limits: no UI, no network, no cross-plugin shared state.
AI-written summary · about
chapters (7)
- 0:00Start
- 2:37ALCATRAZ
- 6:09XCODE GHOST
- 8:44XCODE SOURCE EXTENSIONS
- 13:38SWIFT PACKAGE MANAGER PLUGINS
- 15:141. COMMAND PLUGINS 2. BUILD TOOL PLUGINS
- 21:54BUILD TOOL HARD MODE: CREATE YOUR OWN PLUGIN
related talks
45mSwift Plugins: Speeding Up Project Builds
24mThinking Outside the Box with Swift Package Manager
21mUnlock the Potential of Swift Code Generation
44mSwift Packages - Dependency Management of the Future
25mBuilding with SwiftPM
17mEasy Build Plugins With Mill
42mHow To Put Swift in a Box: Container Images From Scratch With Swift Container Plugin
36mBuilding Swift Packages in VSCode
