[英]Swift Framework with Cocoa Pods
I have created custom swift framework in this I have installed pods for using some third party framework. 我已经在其中创建了自定义的swift框架,并安装了用于使用某些第三方框架的pod。
I am done with the successful build now but How I can use or add that framework in my existing project. 现在我已经完成了成功的构建,但是如何在现有项目中使用或添加该框架。
Do I need to copy the entire framework project in my existing project? 我是否需要在现有项目中复制整个框架项目?
If any one knows the solution please help. 如果有人知道解决方案,请提供帮助。
Thank you. 谢谢。
The most obvious, easiest and manageable solution would be creating a pod . 最明显,最简单和可管理的解决方案是创建一个pod 。 Then declare the required pods in xyz.podspec
file to use your pod as dependencies. 然后在xyz.podspec
文件中声明所需的Pod,以将Pod用作依赖项。
Use your custom cocoapod using following: 使用您的自定义cocoapod,方法如下:
pod 'Name', :path => '~/code/Pods/' # if in local file system
pod 'NAME', :git => 'https://example.com/URL/to/repo/NAME.git' # if it is in your private repo
I was also facing the same problem and here's what I did 我也面临着同样的问题,这就是我所做的
Open the custom framework you are creating, under products section in the navigation bar right click on the your custom framework (eg customFramework.framework) file and select "reveal in finder". 打开要创建的自定义框架,在导航栏中的产品部分下,右键单击您的自定义框架(例如customFramework.framework)文件,然后选择“在finder中显示”。
Now along with your custom framework you can see all the third party frameworks you are using. 现在,连同您的自定义框架,您可以看到您正在使用的所有第三方框架。 Copy all the frameworks you need and paste them wherever you feel like so you can easily access to them. 复制所需的所有框架,然后将其粘贴到所需的任何位置,以便可以轻松访问它们。
Now open up your existing project where you want to use your custom framework. 现在打开您要使用自定义框架的现有项目。
Go to Embedded Binaries section in the general tab of your target. 转到目标常规选项卡中的“嵌入式二进制文件”部分。 Click on the + button -> click on add other -> navigate to location where you pasted all your required frameworks along with your custom framework and click open. 单击+按钮->单击添加其他->导航到将所有必需框架以及自定义框架粘贴到的位置,然后单击打开。
That's it. 而已。 Do this and let me know if it helped you. 这样做,让我知道它是否对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.