1

I made a comparison between an empty project archive written in Swift versus the same project written in Objective-C. For getting the archives sizes I used the locally stored archive files which I have found form the Organizer by going in Finder View. Below are the details:

1) Objective-C project archive size = 2,3MB

2) Swift project archive size = 101,5MB

Is this normal ? Given this fact, should I consider converting my Swift simple projects to Objective-C ?

Thanks!

Tiberiu Oprea
  • 191
  • 1
  • 6

2 Answers2

3

According to this (admittedly dated) Swift Blog post,

...Xcode embeds a small Swift runtime library within your app’s bundle.

Here's another blog post (also from 2014) that you might find relevant.

Having a look at one of my archived iOS projects in Finder with 'Show Package Contents', I see a SwiftSupport folder worth ~50MB. You'll probably find a similar setup.

EDIT: Here's a forum post from the Apple Developer Forums. It suggests that developers can leverage App Thinning to help reduce space usage.

caseynolan
  • 1,236
  • 1
  • 9
  • 11
  • Thanks, however when you talk about small projects, about 2 or 3 MB in size I wouldn't say 50MB is a small library. How this will affect the app size on the App Store ? Is Swift suitable for small projects ? – Tiberiu Oprea Dec 08 '15 at 07:57
  • Remember that there's a difference between a project archive and an actual executable. As for suitability, that's a subjective matter, highly dependent on your requirements. If you're creating a smaller utility application and you simply cannot bear the app size, maybe Objective-C is the way to go. – caseynolan Dec 08 '15 at 08:23
1

After disabling Bitcode form build settings I created new archives from these 2 projects and I was able to reduce a bit this difference:

1) Objective-C project archive size = 2,2MB

2) Swift project archive size = 68,3MB

According to this post the results for the estimated size of the app were:

1) Objective-C size = 163KB

2) Swift size = 17,6MB

There is still a big difference if you ask me, so I think for small projects Objective-C is more suitable.

Community
  • 1
  • 1
Tiberiu Oprea
  • 191
  • 1
  • 6