Creating framework that requires (depends on) another framework

天涯浪子 提交于 2019-12-09 15:27:21

问题


I'd like to create a framework using Cocoa Touch Framework Project in Swift. However, I'm building this framework on top of another framework called RNCryptor, which is Objective-C based. I've seen various tutorials on how to create a framework in Xcode but none has covered a framework with its own dependency.

I tried to create a framework project and then using CocoaPods to manage its dependencies. However, there are errors appeared: 'Check Dependencies' Unable to run command...'

So the question is: is it possible to create a framework on top of another framework in Xcode. And if so, how?


回答1:


Frameworks should never embed other frameworks directly. This leads to collisions if the importing project or any other framework also includes that framework. Instead, you need to tell your consumer that they also need to include your dependency. CocoaPods will do this for you automatically, so you should let it. (If you're having trouble with CocoaPods dependencies, you should ask a question about that and get it cleared up. The whole point of CocoaPods is to manage these kinds of things.)

Note that I will be releasing the Swift version of RNCryptor into beta today (or tomorrow, but I really hope today). This version bridges to ObjC and will be the preferred version going forward. (The ObjC version will continue to be available of course for projects that cannot or don't want to include Swift.)



来源:https://stackoverflow.com/questions/32921566/creating-framework-that-requires-depends-on-another-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!