Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the file size overhead of the bundled Swift libraries compared to an Objective-C app?

Tags:

xcode

ios

I was using Swift in my one of the projects and finally it was time to upload it to the app store. The app size is a concern since downloading an app with larger size is not a user's choice. The app store size of the app was 40MB. It was okay until the android version was uploaded and it was 6MB. I have used app thinning in iOS app and it's still very large. I checked the ipa's (89MB) content and found there were swift libs included in the ipa file. I searched on the internet : Swift libraries included twice in IPA

Then internet convinced me that size of ipa (89MB) is different than the actual size(40MB) which is right. I can see the difference in ipa size and app store download size.

But the android version (6MB in size) is buzzing me.

So what went wrong? If I had used Objective-C would app store size be different?

like image 753
Inder Kumar Rathore Avatar asked Jan 28 '17 07:01

Inder Kumar Rathore


1 Answers

Edit: 17 Sep, 2018

This is from wwdc 2018

And we also have another release coming up for you in the language, Swift 5. The focus of Swift 5 is greater adoption by delivering Swift as part of the OS. Apps will no longer need to include the Swift runtime when delivering on our newer OS releases, resulting in smaller downloads and faster launches. We're very excited about this, too, and we have made great progress toward this goal. And you'll see it in a release coming early next year.

Edit: 23 Nov, 2017

Today I created store build with xcode 9 and found that the swift ipa size has increased from 59MB to 105MB but after uploading to iTunes connect the download size is around 2.5MB, that's cool! So there is very less overhead in terms of size of swift app over objc app.

enter image description here

Edit: 22 Nov, 2017

Today I checked the iTunes connect for the same app and found that new download size tab and it's showing less download size compared to last time experiment. enter image description here


Old answer

I created two single view application with core data for iPhone. One in Swift and other in Objective-C. Both has default project template and didn't write any extra code. I added same app icons in both the projects.

Then created ipa from both the projects and uploaded on iTunesconnect as version 1 and 2

enter image description here

Then I checked both the ipa files using command unzip -lv and found that there were three folders extra in Swift version of ipa

  1. Frameworks (67.09MB)
  2. SwiftSupport (66.56MB)
  3. Symbols (15.42MB)

When I compressed only these three folders (Frameworks+SwiftSupport+ Symbols) then compressed size is 59.5 MB. Whereas the total size of the ipa is 59.6MB. It's clear that Swift library is increasing the size of the app.


unzip -lv SizeSwiftTest.ipa

Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
46125024  Defl:N 18988843  59% 01-28-2017 10:02 14b9d63c  Payload/SizeSwiftTest.app/Frameworks/libswiftCore.dylib
  743568  Defl:N   216552  71% 01-28-2017 10:02 79b72c24  Payload/SizeSwiftTest.app/Frameworks/libswiftCoreData.dylib
 1137184  Defl:N   383891  66% 01-28-2017 10:03 86bd6df6  Payload/SizeSwiftTest.app/Frameworks/libswiftCoreGraphics.dylib
  257616  Defl:N    24550  91% 01-28-2017 10:03 a6da0939  Payload/SizeSwiftTest.app/Frameworks/libswiftCoreImage.dylib
  543696  Defl:N   176102  68% 01-28-2017 10:03 94937782  Payload/SizeSwiftTest.app/Frameworks/libswiftDarwin.dylib
 2562272  Defl:N   954097  63% 01-28-2017 10:04 55a778fc  Payload/SizeSwiftTest.app/Frameworks/libswiftDispatch.dylib
17463360  Defl:N  7412237  58% 01-28-2017 10:04 6f6526c0  Payload/SizeSwiftTest.app/Frameworks/libswiftFoundation.dylib
  506192  Defl:N   165186  67% 01-28-2017 10:04 ad88cf40  Payload/SizeSwiftTest.app/Frameworks/libswiftObjectiveC.dylib
  311520  Defl:N    60300  81% 01-28-2017 10:05 85363d5d  Payload/SizeSwiftTest.app/Frameworks/libswiftQuartzCore.dylib
  699712  Defl:N   273308  61% 01-28-2017 10:05 c7d7022a  Payload/SizeSwiftTest.app/Frameworks/libswiftUIKit.dylib



45775648  Defl:N 18627456  59% 12-07-2016 05:23 81fe5af9  SwiftSupport/iphoneos/libswiftCore.dylib
  741104  Defl:N   209836  72% 12-07-2016 05:23 4acecaad  SwiftSupport/iphoneos/libswiftCoreData.dylib
 1133696  Defl:N   374501  67% 12-07-2016 05:23 8b024942  SwiftSupport/iphoneos/libswiftCoreGraphics.dylib
  256368  Defl:N    22243  91% 12-07-2016 05:23 325cc5a7  SwiftSupport/iphoneos/libswiftCoreImage.dylib
  541792  Defl:N   170804  69% 12-07-2016 05:23 f41ed047  SwiftSupport/iphoneos/libswiftDarwin.dylib
 2522368  Defl:N   932905  63% 12-07-2016 05:22 09cecc4f  SwiftSupport/iphoneos/libswiftDispatch.dylib
17318784  Defl:N  7278280  58% 12-07-2016 05:22 4af20463  SwiftSupport/iphoneos/libswiftFoundation.dylib
  504304  Defl:N   160214  68% 12-07-2016 05:22 1093b583  SwiftSupport/iphoneos/libswiftObjectiveC.dylib
  310112  Defl:N    57522  82% 12-07-2016 05:23 a613dad2  SwiftSupport/iphoneos/libswiftQuartzCore.dylib
  697344  Defl:N   266430  62% 12-07-2016 05:23 d6bf939b  SwiftSupport/iphoneos/libswiftUIKit.dylib



   22576  Defl:N     6387  72% 01-28-2017 10:01 b3c45d81  Symbols/1BFFD5D6-0677-33B3-BAEC-046295DEA090.symbols
   29064  Defl:N     8112  72% 01-28-2017 10:01 d6c556b3  Symbols/2582C775-1993-3EB6-8824-D3F9A75ADE6D.symbols
 3613720  Defl:N   559651  85% 01-28-2017 10:01 34544697  Symbols/26F02EDA-79FE-32B9-BD99-BD076B4736DD.symbols
    1304  Defl:N      580  56% 01-28-2017 10:01 31754a59  Symbols/2A066874-F58A-32D0-A75A-5427D6909F92.symbols
   49808  Defl:N     9569  81% 01-28-2017 10:01 e3f914e6  Symbols/495698EB-ADEA-3C6E-873B-E9F330C364B1.symbols
    1360  Defl:N      576  58% 01-28-2017 10:01 b457ae89  Symbols/4F5C1D31-2B0B-3D45-8307-FF3B01D6678F.symbols
   22488  Defl:N     6471  71% 01-28-2017 10:01 96e50d34  Symbols/57A3E752-CD40-3D39-A10D-0F2156141CFA.symbols
   22488  Defl:N     6476  71% 01-28-2017 10:01 95497af9  Symbols/5A33D6B3-ED31-3EFF-B518-B0F6B1AB518F.symbols
   40600  Defl:N     9804  76% 01-28-2017 10:01 3fa40def  Symbols/5DD3704E-7D46-338B-AA57-875F447D0FDD.symbols
   95120  Defl:N    20420  79% 01-28-2017 10:01 613db8b1  Symbols/66FB5EA4-9401-31BF-917F-ACDB029A1096.symbols
   29064  Defl:N     8109  72% 01-28-2017 10:01 1b159c06  Symbols/6D71045D-16DE-3FEE-9F5C-A3EABD040E64.symbols
    7472  Defl:N     2304  69% 01-28-2017 10:01 374bc5dc  Symbols/6F1E015A-1EA3-3971-8A6F-88759034B452.symbols
   28448  Defl:N     7894  72% 01-28-2017 10:01 a515fee5  Symbols/7613BAC0-954C-3275-BBD6-A8F94CA88169.symbols
   95032  Defl:N    20242  79% 01-28-2017 10:01 c928db8e  Symbols/76EF8DA9-D2AE-340C-8557-18D201C56FC0.symbols
 3625704  Defl:N   564948  84% 01-28-2017 10:01 00d5d560  Symbols/7907E56A-C876-3ADB-8063-60A0C3534C80.symbols
   40656  Defl:N     9702  76% 01-28-2017 10:01 d4193ca3  Symbols/7C39C85D-94F2-34D8-BAD4-9FAA7FBA7A8A.symbols
 3626128  Defl:N   564909  84% 01-28-2017 10:01 dc118cdf  Symbols/7E3DC2DA-66CA-3D75-930C-586D382ED244.symbols
   40528  Defl:N     9797  76% 01-28-2017 10:01 e3f2fc23  Symbols/8E44CE26-99D8-327D-9265-1832F45435E5.symbols
    1304  Defl:N      580  56% 01-28-2017 10:01 bd45ff3f  Symbols/9D3B475B-430C-3E1A-8564-90709511BAA4.symbols
 1253768  Defl:N   223986  82% 01-28-2017 10:01 d9b84785  Symbols/9DB043C4-9AE4-3C6D-9C0B-3F4122CCB651.symbols
   49920  Defl:N     9508  81% 01-28-2017 10:01 48d5b4c2  Symbols/9E5276F6-A162-3960-B721-2AEA6034A9D4.symbols
    7240  Defl:N     2311  68% 01-28-2017 10:01 3a7eb2d0  Symbols/A654D23D-3717-33EA-BFB4-B77C0BB3E29D.symbols
    7240  Defl:N     2306  68% 01-28-2017 10:01 cf9bc3af  Symbols/A9A21BC8-84F5-3F38-B617-05DB8ABA3F14.symbols
  264072  Defl:N    48696  82% 01-28-2017 10:01 4423f05b  Symbols/AAEE95F5-56B7-3601-A0E5-C31446494F6A.symbols
  261616  Defl:N    47707  82% 01-28-2017 10:01 b4ea0b2d  Symbols/AC9C450C-CC64-357D-8F60-F072AE05FA66.symbols
  264224  Defl:N    48725  82% 01-28-2017 10:01 2bfd857d  Symbols/C69555CE-9775-3AEA-9C03-65661C772503.symbols
 1262592  Defl:N   226212  82% 01-28-2017 10:01 39303f9c  Symbols/D4705FA7-7406-3585-84C7-E914BFAB468F.symbols
 1262808  Defl:N   226261  82% 01-28-2017 10:01 83cf2100  Symbols/E6C789A6-E22E-3349-8319-6EACF1400E2E.symbols
   49952  Defl:N     9610  81% 01-28-2017 10:01 c142402b  Symbols/E92BBA7C-157A-3649-8FE6-CD429381BB72.symbols
   95184  Defl:N    20425  79% 01-28-2017 10:01 f91d04e0  Symbols/F78C47B6-F71D-3606-8235-BF2BDA33DDCC.symbols
like image 74
Inder Kumar Rathore Avatar answered Nov 02 '22 13:11

Inder Kumar Rathore