从子项目框架访问父类 [英] Access parent class from subproject framework

查看:63
本文介绍了从子项目框架访问父类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在模块中拆分一个大型XCode项目.我有一个主项目和一个子模块作为嵌入式框架.

I'm trying to split in modules a big XCode project. I have a main project and one submodule as an embedded framework.

我需要将一些类从主项目导入子项目,但是没有成功.我在嵌入式二进制文件和父级项目目标的链接框架中添加了子框架.此外,我在父项目的子项目中添加了构建设置"Header Search Path".

I need to import some classes from the main project into the subproject but no success. I added the subframework in the embedded binaries and in the Linked Frameworks of the parent's project target. Moreover I added in build settings "Header Search Path" in the parent project the path of the subframework.

任何帮助将不胜感激

推荐答案

您不能.这也是没有意义的,因为如果您将部分代码分成框架,则意味着该代码与其他代码没有任何依赖关系.因此,如果您的框架需要在外部导入某个类,则只有两种方法:

You can't. Also it meaningless because if you separate some pieces of your code into framework it means that this code doesn't have any dependencies with other code. So if you have any case when your framework need to import some class outside you have only two ways:

  1. 将其包含在框架中.
  2. 重构框架的类并尝试删除依赖项.

这篇关于从子项目框架访问父类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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