skip to Main Content

Today, iOS developers use lots of third-party to faster development. I have a question for Xcode archive process.

When Xcode archive an app for release, when I choose optimizing for smallest and fastest, the useless code will not in ipa file? or the useless code also archived in ipa?

For Android Studio, this procedure maybe called minimize?
Does Xcode automatically do this for release ipa?

Thanks

2

Answers


  1. I’m not sure if "minimize" is the term used in Android, isn’t it code shrinking or tree shaking? Other terms include dead code elimination, and code stripping.

    To answer the question, neither seem to be done: I added a dependency (Swift Package, specifically SQLite.swift) to a target in an Xcode project, and the size of the application (when archiving/ with release build configuration) increased from 4.3MB to 6.6MB.


    It’s something I unfortunately haven’t cared about much, and your question is good. I hope someone else answers with a better answer.

    Login or Signup to reply.
  2. There is no build settings in Xcode which removes unused/useless code for ipa

    Moreover the compiler setting you used

    Fastest, Smallest [-Os] solves this: The compiler performs all optimizations that do not typically increase code size. This is the preferred option for shipping code because it gives your executable a smaller memory footprint.

    This will help only to reduce the memory footprint of your app, it will not remove unused code

    To have a closer look and if you are using dynamic frameworks you can check the contents of your .ipa you will see a folder named Framework inside that you will find all the pods as .framework and you can even see the files and resources inside them.

    So answer you’re question Does Xcode automatically do this for release ipa? -> NO

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search