Skip to content

Instantly share code, notes, and snippets.

@andresilveirah
Last active May 14, 2019 11:06
Show Gist options
  • Save andresilveirah/184622a7ab8e4f4ec055ed165a193974 to your computer and use it in GitHub Desktop.
Save andresilveirah/184622a7ab8e4f4ec055ed165a193974 to your computer and use it in GitHub Desktop.

Integrating SourcePoint's Swift SDK into an Obj-C Project

Impact in bundle size

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

First Release

Device Compressed Uncompressed App Store Download**
iPhone 169 KB 273 KB 453 KB
iPad 167 KB 261 KB *
Universal 326 KB 564 KB *

Second Release (with our SDK included)

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

Conclusion

  1. 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.
  2. 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.
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment