Local Swift Packages Stopped Working in Xcode 13
Removing package references from workspace and re-adding them (by simple drag-n-drop from Finder) resolved the problem.
I even didn't need to reconfigure corresponding schemes, or re-adding dependencies in targets.
Xcode 13.2.1 unable to resolve Swift Package Manager
I just spent two days on this same issue, and finally got my rather long list of packages to resolve and build. I just can't believe Apple can't fix this. If we could just update one package at a time we could slowly get everything to work. In any case, I just made notes to my team of what I did to finally get all packages to resolve:
If Xcode struggles to resolve them, the solution is complicated and must often be done multiple times (Xcode 13.2.1):
- close the project
- quit Xcode
- delete every folder in the Derived folders, then in Finder delete Trash
- cd to the folder containing the MyProject.xcodeproj and run:
xcodebuild -resolvePackageDependencies -project MyProject.xcodeproj -scheme MyScheme -platform="iOS, name:'Any iOS Device'" - open Xcode
- open the project
Some projects may not resolve or have errors (little red "x"s on the right side). Not good but may be solvable:
- use Xcode "File" -> "Packages" -> "Resolve Packages"
- alternately, close the project, then reopen it.
You will probably get some warnings when running xcode build
, I get:
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:xxx-xxx }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
...
Once you get to a stable position, with no errors and all packages showing version numbers, you should be good for the long haul.
IMPORTANT: occasionally you need to update the minimum version shown in the Project -> Package Dependencies, to reflect the
existing Package release (which you may see from the left Xcode panel, or by visiting the Packages github site. If they are too
old you may have problems resolving after you wipe the Derived Folder (for some other reason, maybe Package Format changed?)
Xcode: Using packages in Xcode 14
There is a change in the syntax for local packages, the .package(url: …
syntax that used to work for packages within the project does not work anymore.
With Xcode 14 local packages that do no have their own repo MUST be referred as:
dependencies: [
.package(path: "../MyLibrary"),
]
Now this works just fine in Xcode 14 beta, but if you're going back to the Xcode release version, you'll get numerous errors. To fix those, reset the package caches by calling
File > Packages > Reset Package Caches
I had the same issue in a project with 14 internal packages, some of them dependent on each other, and it runs fine now in both Xcode 13.4 and Xcode 14 beta.
Hope it helps
Xcode Workspace Internal error: missingPackageDescriptionModule
Fixed on v13.2.1 and you can download from here
Explaination
This bug is reported and the v13.2.1 AppStore version but As Apple suggest here, you should download the Xcode manually from the developer center
Manual download of any Apple developer software
✅ The always working and preferred workaround!
Download directly from Apple:
- Latest Release version or
- Latest Beta version or
- Any version you need and all other downloadable contents
Then extract and move it where you like. This has so many benefits compared to AppStore updates. (like the ability to resume download, not replacing the old one, not wasting hidden directories and etc.)
Note that you should use safari to download it.
⚠️ Important note for developers like me!
The page you’re looking for can’t be found.
If you The page you’re looking for can’t be found
message, you may need to use a VPN if you are in a country that the US sanctioned like mine. Because Apple is blocking some IP address ranges.
Editing a Package Dependency as a Local Package
The reason you cannot see the content of the package is that you have it open in another Xcode instance.
You can only edit a package in one Xcode instance at a time.
I find closing down Xcode completely, then opening up the particular project that I want to edit the package in solves the problem.
Related Topics
Scenekit - Get Direction of Camera
How to Fix Error: This Class Is Not Key Value Coding-Compliant for the Key Tableview.'
Difference Between Packed VS Normal Data Type
Xcode: Could Not Load Modelio.Framework, Scenekit.Framework, etc
Using Cocoa Nssavepanel in Sandbox Causes Assertion Failure
Select Next Nstextfield with Tab Key in Swift
Using Key-Value Programming (Kvp) with Swift
Arkit - How to Put 3D Object on Qrcode
Property Cannot Be Declared Public Because Its Type Uses an Internal Type
Swiftui: How to Draw Filled and Stroked Shape
Performseguewithidentifier in Swift
Generating Random Values in Swift Between Two Integer Values
Unsafemutablepointer<Uint8> to [Uint8] Without Memory Copy
Disable Audio (And Interruption) with Mpmovieplayercontroller Using Swift
iOS 10 App Crashes When Trying to Save Image to Photo Library