Skip to main content
Xcode build step · Open source

Dependi

Licence acknowledgements for the Swift packages your app really links, written into Settings every time you archive. Despite the name, it's not dependency injection. It's about the licences of your dependencies.
The build step

Stop keeping the list by hand

Before

A licences list you update yourself, and hope it still matches what the app ships with after the last package bump.

After

Archive as usual. The app's Settings gets an Acknowledgements pane with one page per package, built from what the app target actually links.
What it writes: one page per package, in your app's own Settings.
How it works

From resolved packages to a Settings pane

  1. Read what Xcode resolved

    It starts from the packages Xcode resolved for your project.
  2. Follow what's linked

    Direct, transitive and local packages, plus anything linked by embedded frameworks and extensions.
  3. Pick the licence files

    Each package's licence files, checked before they're used.
  4. Write the panes

    One pane per package, under an Acknowledgements pane in the app's Settings.bundle.
When it runs

Archives, not every build

Debug builds skip it. Archives always run it, and so does any build configuration you list. The runner script pins a Dependi version, builds it once and caches it in .dependi/bin.
Setup

Three steps

  1. Clone Dependi at the version you want.
  2. Run the setup wizard against your project:
    swift run -c release dependi init --project <path to your app>
  3. Add the Run Script phase the wizard prints, and turn the user script sandbox off for the target that runs it.
That last bit is a real trade-off, so I'd rather say it up front: the sandbox has to be off for that one target.
What it checks

It's fussy on purpose

  • A linked remote package with no licence file is skipped and named in the build log. Set requireLicenses in .dependi.json to make that a failure.
  • Local packages are followed to the remote packages they use.
  • Manual entries cover code that doesn't come from a package.
  • The list sorts the same way every time, whatever the locale or input order.
  • Licence files must be regular files inside their package, under 1 MB and valid text.
  • Every checkout must match the revision Package.resolved pins.
  • Packages that are resolved but not linked fail the build, unless you allow them.
  • It only writes inside the built product, and only ever removes files it made.
Command line

Four commands

CommandMeaning
dependi generateWrites the acknowledgements. Xcode runs this one.
dependi init --project <path> [--dry-run]Sets Dependi up in a project.
dependi --versionPrints the version.
dependi helpPrints the usage.
Why a Run Script

Why not a package plugin?

Dependi runs as a command line tool in a Run Script phase, not as a Swift package plugin. A plugin doesn't get the full dependency graph, it's sandboxed away from the package checkouts, and it can't reliably put files where the app bundle needs them.
Platforms

Where it works

  • iOS
  • iPadOS
  • Mac Catalyst
  • visionOS
  • macOS apps
  • CocoaPods
  • Carthage
macOS apps don't have a Settings.bundle, so they're out, and the wizard stops if your target is macOS only. CocoaPods and Carthage aren't covered either.
How it's built

Tested by breaking it

The code lives in rings, and a test checks that each module only depends on rings further in. Every rule Dependi enforces has an entry in a mutation register. The register breaks the code on purpose and needs a named test to fail each time. Built and tested with Xcode 27.2 (Swift 6.4) on macOS 27. Other Xcode versions aren't tested yet.
  • Swift 6.4
  • Command line tool
  • Xcode Run Script
  • Settings.bundle
  • iOS · iPadOS · Mac Catalyst · visionOS
  • No third-party dependencies
  • Apache-2.0
View on GitHub Back to home