[英]How to add third party libraries to custom framework with CocoaPods?
I want to add third party libraries (like Swinject, or AlamoFire) to my custom framework (that created with swift) with CocoaPods.我想使用 CocoaPods 将第三方库(如 Swinject 或 AlamoFire)添加到我的自定义框架(使用 swift 创建)中。
the way I'm using is open terminal and navigate to my framework directory and run pod init
.我使用的方式是打开终端并导航到我的框架目录并运行
pod init
。 after that adding third party libraries to Podfile and then run pod install
.之后将第三方库添加到 Podfile 然后运行
pod install
。
is this way correct for using my framework later in my app project?这种方式对于稍后在我的应用程序项目中使用我的框架是否正确? and is there a better way for doing this?
有没有更好的方法来做到这一点?
For installing the third-party libraries into the project:将第三方库安装到项目中:
Step 1: Open the terminal and navigate to the project directory.第 1 步:打开终端并导航到项目目录。
Step 2: Type pod init
in the terminal and press enter.第 2 步:在终端中输入
pod init
并按 Enter。
Step 3: Add the third-party libraries into the Podfile.第三步:将第三方库添加到 Podfile 中。
Step 4: Type pod install
in the terminal and press enter.第 4 步:在终端中输入
pod install
并回车。
So, you need to add dependencies in your Custom Pod Podspec -因此,您需要在自定义 Pod Podspec中添加依赖项 -
s.dependency 'Alamofire', "~> 5.4"
s.dependency 'PromiseKit', "~> 5.4"
For further reference - Cocopod Link供进一步参考 - Cocopod 链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.