In order to evaluate what's the impact in bundle size our SDK written in Swift has, we've created a Obj-C project from scratch, archived it for development and released on App Store (TestFlight). We later on added the ConsentViewController
(our SDK) to the project and repeated the proccess.
Some observations:
- App Thinning was enabled and set to
All compatible device variants
in both releases. - Cocoapods was used to manage dependencies.
- In the release that included our SDK, when archiving, the following option was enabled:
Strip Swift symbols
Reduce app size by stripping symbols from Swift standard libraries
- The project created was targeting iOS 8 and above
Device | Compressed | Uncompressed | App Store Download** |
---|---|---|---|
iPhone | 169 KB | 273 KB | 453 KB |
iPad | 167 KB | 261 KB | * |
Universal | 326 KB | 564 KB | * |
Device | Compressed | Uncompressed | App Store Download** |
---|---|---|---|
iPhone | 2,6 MB | 7,5 MB | 918 KB |
iPad | 2,9 MB | 6,5 MB | * |
Universal | 5,5 MB | 14,4 MB | * |
* not tested
** Downloaded on an iPhone Xs running iOS 12.2
- Although adding a Swift framework into the project, does bring a substantial amount of code, XCode and the App Store will do a pretty good job on stripping unused code from the final build.
- For devices running newer versions of iOS, the final build gets considerably smaller since the OS already have some of the run time code embedded.
- With the release of Swift 5 and Swift's ABI stability (and later module stability)
[...] applications written in Swift no longer need to be distributed with the Swift runtime libraries, reducing download size. [...] third parties will also be able to ship binary frameworks written in Swift.