Is there a way to prevent a Swift Package Manager package from exposing its own dependencies to the applications that use the package?
Here's current observed behavior:
Is there a way to prevent LibraryB from being imported when only import LibraryA is used?
(What makes this additionally confounding is that if you open the LibraryA package itself in Xcode, LibraryB is only available when import LibraryB is denoted, which makes sense. However, when an application imports LibraryA, then unconditionally LibraryB is exposed to the application every time. This seems incorrect behavior.)
Here's current observed behavior:
PackageA, a Swift static library (no framework, just source files)
This contains an SPM dependency declared in its Package.swift manifest: PackageB, a static library (no framework, just source files)
In Xcode, in a Application .xcproject, PackageA gets added as a dependency through the Swift Package Manager via its GitHub repo URL
*.swift source files do not see any of LibraryA or LibraryB contents until they are imported (which is normal)
As soon as you import PackageA in a *.swift file, both PackageA and PackageB are exposed in that scope (this is undesirable)
Is there a way to prevent LibraryB from being imported when only import LibraryA is used?
(What makes this additionally confounding is that if you open the LibraryA package itself in Xcode, LibraryB is only available when import LibraryB is denoted, which makes sense. However, when an application imports LibraryA, then unconditionally LibraryB is exposed to the application every time. This seems incorrect behavior.)