Swift 3 App Sizes

In Xcode 8.2, Swift 2.3 is marked as deprecated.


The problem with converting to Swift 3 is that the binaries are 5-10 MB bigger than with Swift 2.3.


I spent about 5 hours converting my app to Swift 3, and when I submitted it to the App Store, it was not accepted by iTunes Connect due to the 50 MB Apple Watch app limit.


The watch app went from 49 MB to about 54 MB due to the increased runtime library size. Note that over 50% of the app size is the Swift runtime library, so it really only leaves maybe 20 MB total for our watch app + extension. We've already removed every non-essential file/image that we are able to.


Please advise how I should convert my app to Swift 3 while this 50 MB limit is in place.


Thanks


Quentin

Streaks, 2016 Apple Design Award winner

How are you measuring the runtime size? The Swift runtime dylibs included in your submission include embedded bitcode that takes up a lot of space. You can run "size -m" on the files to see the size of the __LLVM segment containing the bitcode. If you subtract off the bitcode size, does the total match the size reported when your app was rejected?

Hi there - thanks for the reply. I'm not quite sure I follow what you're asking me.


I'm basing my initial post on being able to upload the Swift 2.3 version fine (albeit with an "approaching 50mb limit" warning when uploading the binary), and after converting to Swift 3 it hit the 50 MB limit, even though my app hasn't changed (i.e. same images/resources in the app+extension).


To check the sizes, I just inspected the xcarchive in Finder, which reported the same sizes as iTunes Connect. Digging deeper in the watch .app file, the Frameworks folder is 24.4 MB.


I guess my main point is that iTC imposes a 50 MB limit, but in effect it's really only 25-30 MB, which has been reduced by about 5 MB when building on Swift 3 instead.


I'm unsure how to proceed with converting to Swift 3 without hitting this limit.


Thanks

Quentin

I see. We're investigating to see what we can do to help with this problem, but it might take a while. In the meantime, the only thing I can think of would be to try to find some way to reduce the size of your app. It sounds like you've already tried that, so I'm not sure what to suggest. You might need to stay on Swift 2.3 for a bit longer.

Any update on this?

Well, the problem is not yet solved but we understand it better now. The actual size of the Swift code and Swift runtime libraries are not the problem. As I mentioned earlier, the Swift libraries in AppStore submissions include embedded bitcode that takes up a lot of space. That bitcode is not included in the final app -- it is only in the submissions to the AppStore. The problem is that the check for the 50 MB limit is calculating the size based on the content in a submission instead of the final app size, so that Swift apps for watchOS are severely constrained in size. I expect this to be fixed soon but I can't give a specific timeline.

I am experiencing this problem with my watchOS app. On Xcode 8 / Switft 3 my watchOS app was under 50MB but after switching to Xcode 9 and updating my app to Swift 3.2 using the migrator (no other code changes or additions) my watch app is now 58MB and I am not able to submit updates to the App Store. The only files that inceased in size between the two versions are the swift runtime libraries.

If you've run into this problem, please try to resubmit your app. It should work now.


We're still working on a full solution to the problem I described earlier, but we made some adjustments so that an app that fit within the limit when built with Xcode 8 should also be accepted when it is rebuilt with Xcode 9.

Swift 3 App Sizes
 
 
Q