sideeffect-io / AsyncExtensions

AsyncExtensions aims to mimic Swift Combine operators for async sequences.
MIT License
334 stars 26 forks source link

Avoid sharing schemes with library users #29

Open davdroman opened 2 years ago

davdroman commented 2 years ago

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

twittemb commented 2 years ago

Thanks for the PR. I'll review it ASAP

twittemb commented 2 years ago

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?

davdroman commented 2 years ago

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

Sajjon commented 1 year ago

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.