Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift project is larger than I expect

My project has 4 frameworks and 31 (31 language) custom keyboard extensions. When I compile it, it takes 98 mb of internal device memory.

So I decided to take a look why so much. I found my project in the device folder.

enter image description here

Folder Plugins takes 38 mb, and folder Frameworks takes 42 mb.

enter image description here

enter image description here

In Frameworks folder is 4 my frameworks and 8 Swift's frameworks, that you can see at picture above

enter image description here

Each my framework contain the same 8 Swift's frameworks. Can I somehow add this swift frameworks only once?

It's not all. In Plugins folder is my custom keyboard extensions folders. I have 200 images added into one of my module(framework), and referenced that into each extension(because they need that images for building keyboard). But in project folder each extension folder has that images. It takes lots of memory.

So... Can I somehow add images only once (not for each custom keyboard extension)? And can I add swift frameworks only once(not for each my framework and project too)?

Edit:

I undersnad that each custom keyboard extension is like separate program. So maby they realy need to copy that images into each extension.

like image 584
Vasyl Khmil Avatar asked Aug 19 '14 11:08

Vasyl Khmil


1 Answers

It looks like this is due to the measures taken to achieve compatibility guarantees.

... Xcode embeds a small Swift runtime library within your app’s bundle. Because the library is embedded, your app uses a consistent version of Swift that runs on past, present, and future OS releases.

It is interesting that you're seeing it in each one of your frameworks. This statement seems to suggest that the framework does not include the runtime libraries.

While your app’s runtime compatibility is ensured, the Swift language itself will continue to evolve, and the binary interface will also change. To be safe, all components of your app should be built with the same version of Xcode and the Swift compiler to ensure that they work together.

Source: Swift Blog - Compatibility

I am not sure that you have control over this. A good bet would be to hit the devforums to see if the Swift creators can shed some more light.

like image 52
Chris Wagner Avatar answered Oct 13 '22 08:10

Chris Wagner