简体   繁体   中英

Share Storyboard between iOS App and its Extension

I created a iOS App and a corresponding action extension. I managed to create a app group to share the NSUserDefaults between the app and the extension.

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?

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. These xibs would then be compiled in to a framework that is used by both your app and extension.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM