Avoid sharing schemes with library users
Description
When consuming this library as a dependency in my project, I noticed Xcode autogenerated a scheme for the library among my local schemes, which is not desirable behavior.
As a workaround, this PR gitignores .swiftpm altogether and introduces an xcworkspace as a scheme container that disallows SPM from leaking schemes onto consumers.
Libraries as big as TCA use this approach to effectively hide away all its schemes (and subdependency schemes) from users.
Checklist
- [x] this PR is based on the main branch and is up-to-date, if not please rebase your branch on the top of main
- [x] the commits inside this PR have explicit commit messages
- [x] ~~unit tests cover the new feature or the bug fix~~
- [x] ~~the feature is documented in the README.md if it makes sense~~
- [ ] the CHANGELOG is up-to-date
Thanks for the PR. I'll review it ASAP
Hi,
I’ve just learned about @_implementationOnly. I think it allows to hide the internal deps from the consumer. Perhaps it could address the issue you’re describing?
Have you already used such a statement?
AFAIK that only helps ensure that internal modules aren't visible to consumers, but schemes are still exported because they're included in the .swiftpm folder so Xcode sees them regardless of module visibility.
Ref: https://forums.swift.org/t/preventing-spm-packages-dependencies-from-being-exported-when-importing-the-package/43660
This is a nice addition! Without this Xcode selects AsyncExtension as active scheme because it starts with "A" instead of my host SPM project Foo which has a dependency on AsyncExtension. The effect of this is when I open Xcode and press CMD U to test, Xcode tries to test AsyncExtension which fails.