Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: Own Swift packages missing in Schema selector

I have some SPM swift packages as part of my swift project.

After some Xcode crashes, those packages don't appear in the Schema selector (black arrow in image) any more.

So I can't select and build the swift packages any more separately.

What can I do to fix this?

enter image description here

like image 850
Gerd Castan Avatar asked Dec 20 '25 21:12

Gerd Castan


2 Answers

For me it was solved by deleting .swiftpm/ folder

(Although, maybe just removing xcshareddata would've been enough)

Steps:

  • Removing dependency + reference from the main project
  • Delete .swiftpm/ of "problematic" local package
  • Add the package dependency back to the project

At least it worked.. Hoping there's a better way to solve this as well.

like image 142
Glaphi Avatar answered Dec 22 '25 13:12

Glaphi


There must be a better way to resolve this, but at least it works:

Usual housekeeping:

  • Clear derived data
  • File -> Packages -> Reset Package Caches
  • Restart Xcode

For each package that Xcode doesn't find / build:

  1. Click on package -> show in Finder
  2. In Finder, move the whole package into a temporary folder (package in Xcode gets red)
  3. Delete red package in Xcode
  4. Create package again in Xcode with the same name (File -> New -> Package...), add package to appropriate targets again
  5. Remove the newly generated swift files in Xcode, including Package.swift
  6. Drag the files in your copied folder into the corresponding place in the Xcode package
  7. File -> Packages -> Reset Package Caches (for some reason Xcode loses external packages each iteration)
  8. Build -> should be one less missing package in the error messages
like image 37
Gerd Castan Avatar answered Dec 22 '25 12:12

Gerd Castan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!