Sharing code between original iOS App and App Extension

狂风中的少年 提交于 2019-11-27 22:44:11

Nothing should be copied. Just add required files to compile sources for your extension:

Just make sure that the files you want to share gets a tick in the section Target Membership.

Select your file, open the utility panel on the right and tick the appropriate target under Target Membership.

Embedded frameworks are a great way to reuse code between your application and your extension. Having moved some of the code to embedded frameworks will provide us with a great opportunity to write some unit tests around it.

See section Using an Embedded Framework to Share Code https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1

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