I’ve made a fairly large number of packages, and I keep running into an extremely annoying problem: system libraries.
When I make a package, I want it to “just work”. If I depend on other packages, it basically does: SPM will automatically pull everything I need, and everything will work on every platform. If a requirement isn’t satisfied, the package consumer will know immediately.
But this breaks down once the package (or worse, a dependency thereof) wants to use a module that’s built-in.
Consider Foundation: while it’s expected to be on most platforms, it is not the standard library. It is quite plausible that a platform won’t have it, and SPM is helpless to convey that dependency.
Worse, consider something like SwiftUI or Combine: most platforms that run Swift can’t run those, and SPM can’t make such a requirement clear. Ideally, I’d be able to say “this product must be able to import a module with this name”. But I can’t even express that.
What’s a good solution for this? I’ve ultimately ended up just putting comments in the package manifest saying what I use, but that’s not particularly helpful for someone trying to use it as a transient dependency.