简体   繁体   中英

How to create a cocoa touch framework with its own pods

I have not seen this question asked, and answered for several years. We are now on much newer versions of Xcode and Pods so I think it is worth re-visiting.

If I want to create a cocoa touch framework that itself wants to be dependent on specific pods how does one go about this?

I want to add a few pods, like alamofire, to a cocoa touch framework I use in several other workspaces that also use their own pods.

I was about to add the pods to the frameworks and then realized all the issues that may come up and thought I would ask here first because I saw no real relevant information that was related to the latest Xcode and pod versions.

This is for iOS swift projects using Xcode 10.

Any inside from those who already do this is appreciated!

Thanks, B

Firstly, adding a another library in your on cocoa touch framework results into a umbrella framework which is not recommended by Apple. You can check below:

Why are umbrella frameworks discouraged?

Answer to your question:

Create your cocoa touch framework (Say it as MyLib) which depends on other library (Say it ThirdPartyLib). In this scenario you have to explicitly mention to developers who will use MyLib they have to add ThirdPartyLib as well in their project.

If you upload your library on cocoapods there use can mention in podspec file with property:

s.ios.dependency 'ThirdPartyLib'

Doing above dependent library will install with your framework, when any developer try to install you MyLib pod.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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