Doing things the hard way…

But only once

Swift Embedded Runtime Library Increases App Size

Since beginning Swift attracted a lot of attention, one of many questions was: How Apple will guarantee backwards compatibility in future Swift releases?

The response is cited a few times at Swift Blog, like the post of 1.0 release:

Because your apps today embed a version of the Swift GM runtime, they will continue to run well into the future.

But one thing, so far, I don’t see people talking about is how this embedded library affect the size of an app?

The easiest way to discover is to create an empty project and compare the size. I created two Single View Application projects using on Xcode 6.0.1. On the first image is the bundle directory of Objective-C app and on the second the Swift one.

The Objective-C only app bundle takes only 192 KB and the Swift app bundle 8.6 MB. The Swift binary is smaller but the runtime frameworks can be a huge overhead for many apps!

On the second post of Swift Blog talk about Compatibility:

As Swift changes, those frameworks will be incompatible with the rest of your app. When the binary interface stabilizes in a year or two, the Swift runtime will become part of the host OS and this limitation will no longer exist.

So for at least one year if you want to use Swift in your apps, you will have to accept this little overhead.


Update 2014/09/30: Worth to mention that the runtime libraries are embedded on every app that supports Swift, no matter the minimum deployment target.