Swift6 private import and transitive dependencies

It looks like in Swift6, FRAMEWORK_SEARCH_PATHS are required to point to all transitive dependencies

Long story short.

Framework A depends on Framework B dependes on Framework P(private).
Framework P is pre-build framework, which is located at some external directory, and can be found by adding FRAMEWORK_SEARCH_PATHS to the Framework B settings

We want to hide information about the existance of framework P.

In swift 5.9 with (enable-experimental-feature AccessLevelOnImport), and private import P in Framework B, Framework A was buliding successfully.
Note: While everything was building just fine, it was clearly visible in generated module interface that framework B is using framework P

When switched to Swif6, now build fails on line

// In Framework A
import B // error: missing required module P

This error can be fixed by the adding FRAMEWORK_SEARCH_PATHS to the Framework A settings. But this is kind'a overkill, and disrupts the whole idea of hiding the dependency.

This error also can be fixed by adding @_implementationOnly import P. But then Swift compiler will give a warning that using '@_implementationOnly' without enabling library evolution for Framework P may lead to instability during execution

Here is the most close-related issue to mine

Any help is appreciated. Thanks

1 Like

Ran into this as well. @_implementationOnly import worked for our use case because the private dep was an XCFramework with library evolution enabled. Ideally we could use private import instead.