简体   繁体   English

如何使用 CocoaPods 将第三方库添加到自定义框架?

[英]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.

相关问题 CocoaPods 如何将Podfile中Framework的自定义子类添加到CocoaPods框架中 - CocoaPods How to add a custom Subclass of a Framework in a Podfile to a CocoaPods framework 如何将 pod(第三方框架)添加到我的自定义可可触摸框架中? - How can i add pod(third party framework) into my custom cocoa touch framework? 使用第三方(CocoaPods)库有哪些限制? - What are limitations on using third-party(CocoaPods) libraries? 如何在Xamarin.iOS项目中添加第三方库/框架? - How to add third party libraries/frameworks in Xamarin.iOS project? 如何修改XCODE(使用CocoaPods导入)中第三方框架的Info,plist? - How to modify the Info,plist of a third-party framework in XCODE (imported using CocoaPods)? 在自定义ios框架中导入第三方框架 - Import Third Party Framework in custom ios framework 如何在iOS中正确链接第三方库 - How to link third party libraries properly in iOS 如何将自己的课程导入Cocoapods第三方库? - How to import my own class into Cocoapods third party library? 具有第三方静态库和框架的Cocoa Touch框架 - Cocoa Touch Framework with third-party static libraries and frameworks 当我使用 AppCode 时,我无法通过 CocoaPods 使用第三方库 - When I use AppCode, I cannot use third-party libraries through CocoaPods
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM