ARTICLE AD BOX
I am building a framework for others to use. The framework itself is not built with SPM, but with Xcode. (It has a .xcodeproj file.)
Now I want to use macros in this framework. As far as I know, both the macro implementation and macro declaration must be in a Swift Package. So I created a new Swift Package with --type macro, and added that as a local package dependency of the framework.
Since the macro declaration is public, the users using my framework will also be able to use the macro by importing the modules of the Swift Package. This is undesirable.
I found that the package access modifier seems to be designed to solve this problem. It is supposed to allow different modules that form one single "package" to access each others' code. It doesn't seem like this is only applicable to SPM projects, as it mentions
Swift as a language leaves it up to the build system to define the boundaries of a package.
So I assume there is some build setting in Xcode that allows me to include the SPM packages to be considered the same "package" as the Xcode framework target.
I found a build setting named SWIFT_PACKAGE_NAME, which sounds promising:
An identifier that allows grouping of modules with access to symbols with a package access modifier.
But I don't know what to set this to. I tried setting it to the same name as the Swift package containing the macro (the name passed as the first parameter to Package.init in Package.swift), but I still cannot access package symbols.
What can I do to prevent users of my framework from accessing the Swift Packages that my framework depends on?
