创建需要(取决于)另一个框架的框架 [英] Creating framework that requires (depends on) another framework

查看:124
本文介绍了创建需要(取决于)另一个框架的框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Swift中使用Cocoa Touch Framework Project创建一个框架.但是,我在另一个称为RNCryptor的框架(基于Objective-C)的基础上构建了该框架.我看过各种有关如何在Xcode中创建框架的教程,但是没有一个教程涵盖了具有自己依赖性的框架.

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.

我尝试创建一个框架项目,然后使用CocoaPods管理其依赖项.但是,出现了错误:'Check Dependencies'无法运行命令...'

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...'

所以问题是:是否可以在Xcode的另一个框架之上创建一个框架.如果可以,怎么办?

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

推荐答案

Framework绝对不能直接嵌入其他框架.如果导入项目或任何其他框架也包括该框架,则会导致冲突.相反,您需要告诉您的消费者,他们还需要包括您的依赖项. CocoaPods会自动为您执行此操作,因此您应该放任它. (如果您在使用CocoaPods依赖项时遇到麻烦,应该提出一个问题并予以解决.CocoaPods的全部要点是管理这类事情.)

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.)

请注意,我将在今天(或明天)将Swift版本的RNCryptor发布到beta中,但我今天确实希望如此.该版本桥接到ObjC,并且将是以后的首选版本. (ObjC版本当然可以继续用于那些无法或不希望包含Swift的项目.)

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.)

这篇关于创建需要(取决于)另一个框架的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆