How to delete Swift Package Dependency in Xcode 11?

微笑、不失礼 提交于 2020-07-17 09:19:04

问题


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:


  1. Open Xcode
  2. Select your project
  3. Look at the top middle
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!