简体   繁体   English

在 Xcode 项目中本地添加 Swift Package 依赖

[英]Add Swift Package Dependency Locally in Xcode Project

I have been trying to add Swift Package dependency ("wireguard") in my xcode project but it shows the error that ld: Library not found我一直在尝试在我的 xcode 项目中添加 Swift Package 依赖项(“wireguard”),但它显示错误 ld: Library not found

I have added it locally with URL path like path///user/Desktop/xyz and from GitHub as well but it shows the same error.我已经在本地使用 URL 路径(如 path///user/Desktop/xyz 和 GitHub )添加它,但它显示相同的错误。 I have tried many solution from stack overflow and many other platforms but nothing works.我从堆栈溢出和许多其他平台尝试了许多解决方案,但没有任何效果。

Please guide me how to add SPM locally in my project My xcode version is 12.3.请指导我如何在我的项目中本地添加 SPM 我的 xcode 版本是 12.3。 PS I have access to apple developer account and my local package is working fine no errors their. PS 我可以访问苹果开发者帐户,并且我的本地 package 工作正常,没有错误。

As it seems you can drag&drop the folder containing your framework project into your apps Xcode project and then link it as target dependency.看起来您可以将包含框架项目的文件夹拖放到您的应用程序 Xcode 项目中,然后将其链接为目标依赖项。 You can read the full thread in the Swift forum below:您可以在下面的 Swift 论坛中阅读完整主题:

https://forums.swift.org/t/how-to-add-local-swift-package-as-dependency/26457/31 https://forums.swift.org/t/how-to-add-local-swift-package-as-dependency/26457/31

This is a minor point but important one with drag & drop.这是一个小问题,但对于拖放很重要。 When you drag the folder in (that contains the Package.swift file), make sure to drop it on the top level project.当您将文件夹拖入(包含 Package.swift 文件)时,请确保将其放到顶层项目中。 Only then did Xcode recognise it as a local package correctly, also overriding the non-local package dependency in the project.只有这样 Xcode 才正确地将其识别为本地 package,同时覆盖项目中的非本地 package 依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM