问题
I have a project in Xcode 11 that I added Swift Package Manager dependencies to. I now realized that I no longer need one of the package dependencies I previously added to my project.
As you can see below, there are no options under File > Swift Packages
for deleting a packager from Swift Package Manager for this project.
I have tried removing the package from the array in the project.xcworkspace/xcshareddata/swiftpm/Package.resolved
file. But it still doesn't remove it from Xcode, and the next time I Update to Latest Package Versions
it readds the entry to the Package.resolved
file.
How can I delete a Swift Package Manager dependency in my project?
回答1:
- Open Xcode
- Select your project
- Look at the top middle
- Select Swift Package Manager menu
You'll be able to manage your packages (add / remove)
回答2:
In addition to Pierre's answer, this was driving me crazy, I had a sub project that I was editing, I forgot about that (it was in a subfolder). Even though I removed it in the "Swift Packages" pane it kept coming back. Removing that sub folder reference made sure the PM dependencies went away.
回答3:
Firstly I removed it from dependencies and targets in Package.swift, then i regenerated my project file with swift package generate-xcodeproj
来源:https://stackoverflow.com/questions/56718121/how-to-delete-swift-package-dependency-in-xcode-11