在原始iOS App和App Extension之间共享代码 [英] Sharing code between original iOS App and App Extension
问题描述
在iOS应用和扩展应用之间共享课程
Sharing class between iOS app and extension app
我想在我的应用和扩展应用中使用自定义课程。如果我只是在主应用程序文件夹中有该类,则扩展程序不会接收它。我尝试制作它的副本并将其放入扩展文件夹,但我当然得到无效重新声明[my class]
错误。什么是最好的解决方案?它只是一个类,而不是多个资源。
I want to use a custom class in both my app and the extension app. If I just have the class in the main app folder, the extension doesn't pick up on it. I tried making a copy of it and putting it into the extension folder, but I of course get a invalid redeclaration of [my class]
error. What's the best solution for this? It's just one class, not multiple resources.
推荐答案
不应复制任何内容。只需添加所需文件即可为您的扩展程序编译源代码:
Nothing should be copied. Just add required files to compile sources for your extension:
这篇关于在原始iOS App和App Extension之间共享代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!