In SwiftPM, we added the notion of products which I think makes a lot of sense, but one downside is that the product name in the manifest is completely decoupled from the module name that a client imports.
In practice, I think that "good" packages should always aspire to provide a Swift module with the exact name of the product, so that the normal client usage is to depend on product Foo and also import Foo in their code.
Here is a thought:
What if SwiftPM would automatically synthesize such a module, if the developer didn't actually define one. That module would consist of a single Swift source file using
So if I had
products: [.product(name: "Foo", dependencies: ["Baz", "Qux"])]
then SwiftPM would synthesize a Swift module
Foo which would be compiled from a single source file:
@_exported import Baz @_exported import Qux
WDYT? Is this too magic? I think it ends up giving a better user experience than what we have today, and we could also imagine that one day the Swift compiler would just give us better tools to express the product notion directly.