Xcode creates schemes for some referenced Swift Packages

Xcode always creates targets /schemes for referenced Swift packages. In my app there are 14 Swift packages that are referenced. My app itself has two targets (app and an auto launcher) and Xcode creates targets for two schemes. I don't understand why those schemes are created (and why not for every package). Is there any way to disable this feature? Can someone explain why Xcode creates schemes for referenced Swift packages? I deleted the schemes several times, but Xcode simply recreates them.

Accepted Reply

This is indeed undesirable behavior. I'm not sure whether Apple is aware but you should file a feedback for it.

In the meantime, there's a workaround you can propose to your third party libraries' maintainers to adopt, and it consists on using an xcworkspace as the scheme container as opposed to .swiftpm. Example: https://github.com/sideeffect-io/AsyncExtensions/pull/29.

As I said, unfortunately this is up to the maintainers to adopt, not you, as Xcode reads the checked in .swiftpm folder from your dependencies and grabs the schemes from there without you having a say in it. Again, probably undersirable behavior and an oversight from the Xcode team, so worth filing a radar.

Replies

This is indeed undesirable behavior. I'm not sure whether Apple is aware but you should file a feedback for it.

In the meantime, there's a workaround you can propose to your third party libraries' maintainers to adopt, and it consists on using an xcworkspace as the scheme container as opposed to .swiftpm. Example: https://github.com/sideeffect-io/AsyncExtensions/pull/29.

As I said, unfortunately this is up to the maintainers to adopt, not you, as Xcode reads the checked in .swiftpm folder from your dependencies and grabs the schemes from there without you having a say in it. Again, probably undersirable behavior and an oversight from the Xcode team, so worth filing a radar.

Hello,

thank you very much for the reply, I will try this out. Good thing is: Those are all my frameworks.

The only thing that I don't understand is why Xcode does create schemes for the same two packages and not for all of them? But I will definitely write a Feedback, although I have a feeling that nobody reads them anyways.

Are these packages of yours dependencies in Package.swift, or do they live locally alongside your project? If the former, then my answer applies (make sure to .gitignore .swiftpm from whatever repo you're storing your packages in). If the latter, then this is standard behavior from Xcode as it autogenerates schemes for all local package products.