Swift App Bundle Sizes

I’m looking at building a casual game for iOS and one of the extremely important things is to make sure that the app bundle size is as small as possible. I want users to be able to quickly download, and most importantly, not be blocked by the cellular download size limit, which is currently 100MB.

I did a directly listing of the Frameworks directory in an app bundle and was a little dismayed:

Filename                       Size (b)
------------------------------------
libswiftAVFoundation.dylib      254000
libswiftCore.dylib            14221040
libswiftCoreAudio.dylib         396048
libswiftCoreGraphics.dylib      543632
libswiftCoreImage.dylib         207888
libswiftCoreMedia.dylib         253072
libswiftDarwin.dylib            295808
libswiftDispatch.dylib         1093360
libswiftFoundation.dylib       5418720
libswiftGLKit.dylib             246576
libswiftGameplayKit.dylib       212160
libswiftObjectiveC.dylib        258544
libswiftSceneKit.dylib          250544
libswiftSpriteKit.dylib         250064
libswiftUIKit.dylib             348048
libswiftos.dylib                247696
libswiftsimd.dylib             1003200

That’s a total of 25,500,400 bytes (or approx 25 MB)!! Yikes!

Surely, that’s not really the size, right!? The xcarchive must be smaller do some thinning, yeah?

Filename                       Size (b)
------------------------------------
libswiftAVFoundation.dylib      451440
libswiftCore.dylib            45120816
libswiftCoreAudio.dylib         774336
libswiftCoreGraphics.dylib     1135952
libswiftCoreImage.dylib         257248
libswiftCoreMedia.dylib         450512
libswiftDarwin.dylib            542608
libswiftDispatch.dylib         2541392
libswiftFoundation.dylib      16854896
libswiftGameplayKit.dylib       345296
libswiftGLKit.dylib             310880
libswiftObjectiveC.dylib        488960
libswiftos.dylib                398624
libswiftSceneKit.dylib          348784
libswiftsimd.dylib              693568
libswiftSpriteKit.dylib         395776
libswiftUIKit.dylib            3010368

This is a total of 74,121,456 bytes (or approx 74 MB)… ugh, that’s a lot.

I reached out on Twitter to see who’s actually shipping Swift apps. If the app bundle size is going to really be between 25MB and 75MB for Swift support alone, that’s going to be a deal breaker for me.

Fortunately, all of these file sizes are just what the local size. The App Store is where all of the thinning is being done. The actual size bump for a shipping product with Swift support is much smaller:

Filename                       Size (b)
------------------------------------
libswiftContacts.dylib          147200
libswiftCore.dylib             7680608
libswiftCoreData.dylib          147568
libswiftCoreGraphics.dylib      268016
libswiftCoreImage.dylib         141568
libswiftDarwin.dylib            180576
libswiftDispatch.dylib          147104
libswiftFoundation.dylib        902016
libswiftObjectiveC.dylib        173168
libswiftUIKit.dylib             203408
libswiftWebKit.dylib            147392

Alrighty, so this is looking better, but still not great: 10,138,624 bytes (approx 10 MB). This of course is missing some of the frameworks that I was using above, like Swift support for AV Foundation, but seeing as libswiftCore is the primary culprit of the size, I think it’s safe to say that budgeting for 15 MB for Swift support should be sufficient.

This is still a large amount, but vastly better than I initially feared. I’m still not sure what I’m going to do, but at least I have a better ball park estimation.

Update:

I should also note that the App Store does compress your bundle as well. At the end, it’s really hard to know exactly how big your app bundle is going to be without actually publishing it up to the store. If anyone has any tips or tricks on that, please share on Twitter.

Swift App Bundle Sizes