I‘m now using a xcassets
for my main app, and I want to use these assets in my extension target. I add the extension to the target membership of xcassets
.
It works fine but when I check the product size, it became larger and it seems to have copied the asset file again to the extension.
Is there any way to still use the asset catalog, and share the resources without extra copy?
I‘m now using a xcassets
for my main app, and I want to use these assets in my extension target. I add the extension to the target membership of xcassets
.
It works fine but when I check the product size, it became larger and it seems to have copied the asset file again to the extension.
Is there any way to still use the asset catalog, and share the resources without extra copy?
Is there any way to still use the asset catalog, and share the resources without extra copy?
No. The entire nature of an extension is that it is completely independent from the host app; it is, in effect, a completely independent mini-app on its own. It cannot magically "reach into" the host app's bundle; that is why including the asset catalog causes the asset catalog to be compiled separately into the host app bundle and the extension bundle.
What you can do, of course, is have the app write the resources into a shared app group directory, where the extension can find them, in exactly the same way you would share any resource between an extension and its host app. But this would have disadvantages of its own; for example, it would mean that the extension would not work properly until the app had run once.