如何在 Xcode 11 中删除 Swift Package Dependency?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/56718121/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to delete Swift Package Dependency in Xcode 11?
提问by Charlie Fish
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.
我在 Xcode 11 中有一个项目,我向其中添加了 Swift Package Manager 依赖项。我现在意识到我不再需要我之前添加到我的项目中的包依赖项之一。
As you can see below, there are no options under File > Swift Packages
for deleting a packager from Swift Package Manager for this project.
正如您在下面看到的,在File > Swift Packages
从 Swift 包管理器中删除此项目的打包器时没有选项。
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.
我尝试从project.xcworkspace/xcshareddata/swiftpm/Package.resolved
文件中的数组中删除包。但它仍然没有从 Xcode 中删除它,下次我Update to Latest Package Versions
读取Package.resolved
文件的条目时。
How can I delete a Swift Package Manager dependency in my project?
如何删除项目中的 Swift Package Manager 依赖项?
回答by Pierre
回答by possen
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.
除了皮埃尔的回答,这让我发疯,我有一个正在编辑的子项目,我忘记了(它在一个子文件夹中)。即使我在“Swift Packages”窗格中删除了它,它仍然会回来。删除该子文件夹引用可确保 PM 依赖项消失。
回答by toupper
Firstly I removed it from dependencies and targets in Package.swift, then i regenerated my project file with swift package generate-xcodeproj
首先我从 Package.swift 中的依赖项和目标中删除它,然后我重新生成了我的项目文件 swift package generate-xcodeproj