'Xcode: Own Swift packages missing in Schema selector
Solution 1:[1]
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.
Solution 2:[2]
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:
- Klick on package -> show in Finder
- in finder, move the whole package into a temporary folder (package in Xcode gets red)
- delete red package in Xcode
- Create package again in Xcode with the same name (File -> New -> Package...), add package to appropriate targets again
- remove the newly generated swift files in XCode, including Package.swift
- drag the files in your copied folder into the corresponding place in the Xcode package
- File -> Packages -> Reset Package Caches (for some reason Xcode loses external packages each iteration)
- Build -> should be one less missing package in the error messages
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Glaphi |
Solution 2 | Gerd Castan |