Xcode schemes for package projects

I've been working on a Vapor project for a while (using Xcode, but it's an SPM project), but after recently adding a dependency and then invoking Xcode’s "Update to Latest Package Versions" command, all of my schemes are broken. This has happened before, but I'm not sure how I resolved it (I think I closed and reopened the project, which didn't work this time).

There are four schemes for some reason. I have two targets in Package.swift. The Run Destination for my schemes is either "no device" or "My Mac," but these change every time I try to Run or Build. In all cases, Run and Build are disabled.

Inspecting some of the schemes, I see "Expand Variables Based on" with a popup of other schemes next to it. All of those are listed as "(missing)."

I really don't know what's going on, but it's extremely frustrating. Any ideas how to clean this up and make it reliable?

Broken schemes with XPM usually means that dependency resolution failed. Is there an error in the report navigator or does swift package resolve show anything?

To fix other issues, you can do a clean, remove the .swiftpm directory and/or delete derived data. Or even delete Package.resolved if the resolved file is corrupted. One of those should fix it

1 Like

Alas, I dealt with it by deleting .swiftpm and letting Xcode rebuild everything. Which kinda sucked because I had to remember the scheme customizations I had done like setting the PWD (I think the PROJECT_DIR is a better default PWD).

Terms of Service

Privacy Policy

Cookie Policy