Accessing Swift Package Manager dependency versions at runtime

I was building a debug screen for an iOS/Mac app and wanted to display the version of a third-party dependencies managed by Swift Package Manager. My first instinct was to use an Xcode run script build phase to extract version information at build time, but I quickly ran into various code signing errors that made this approach unreliable. Especially because building for macOS triggered code…