[英]Share Storyboard between iOS App and its Extension
I created a iOS App and a corresponding action extension. 我创建了一个iOS App和一个相应的动作扩展。 I managed to create a app group to share the NSUserDefaults between the app and the extension.
我设法创建了一个应用程序组,以在应用程序和扩展之间共享NSUserDefaults。
Now i want to reuse some parts of my storyboard from the main app in the extension. 现在,我想从扩展中的主应用程序重用故事板的某些部分。 How can I share the storyboard between the app and the extension?
如何在应用程序和扩展程序之间共享情节提要? Can anyone provide an example in Swift?
谁能在Swift中提供示例?
Thank you. 谢谢。
If you want to share views between your app and extension, you would need to create xibs for each view you wanted to share. 如果要在应用程序和扩展之间共享视图,则需要为要共享的每个视图创建xib。 These xibs would then be compiled in to a framework that is used by both your app and extension.
然后,将这些xib编译到应用程序和扩展程序都使用的框架中。
It also may be possible to create a separate storyboard with the shared views, then put this storyboard in to the framework. 也可以使用共享视图创建一个单独的情节提要,然后将该情节提要放到框架中。
The xib route seemed more correct to me, as you won't be composing a scene with the storyboard, just throwing a bunch of views in it. xib路线对我来说似乎更正确,因为您不会使用情节提要来构成场景,而只是在其中添加一堆视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.