Xcode Swift executable size much bigger than Objective-C executable

swift, xcode6

Solution

This is to be expected.

For the time being, Swift itself lives in the binary of each application built with it. This may change when Swift reaches a release that Apple is comfortable bundling with iOS, but for now it's just something we have to live with. This behavior is the reason you can build an iOS 7/8 application in Swift 1.0/1.1/1.2 and it just works when you build and run.

You can find more info on this in this article.

Problem

Executable size of Swift application is much bigger than size of Objective-C application. For a new empty Cocoa Application project : - in Objective-C, after build phase, I get a 65 Kb executable - in Swift, after build phase, I get a 4.2 Mb executable, 66 times more !!! If I look at the generated package, there is a lot of frameworks included : - libswiftAppKit.dylib, libswiftCore.dylib (3.2Mb), libswiftCoreGraphics.dylib, libswiftDarwin.dylib, libswiftDispatch.dylib, libswiftFoundation.dylib, libswiftObjectiveC.dylib, libswiftQuartzCore.dylib, libswiftSecurity.dylib I did not find project parameters to specify to include these libraries... How is it that Swift executables are not build the same as in Objective-C ? Version of Xcode used : 6.1.1

Original source