Some test text!

Search
Hamburger Icon

iOS / Guides / Reduce the lib size

Reduce the Framework Size

Question: PDFNet is a large framework. Will it make my app large as well?

In short, no, it will not. The PDFNet framework is indeed large, but only a small fraction of its total size makes it into your app. The reasons for this are explained below.

The PDFNet framework includes machine code for 4 architectures (32-bit for simulator, 32-bit for device, 64-bit for simulator, 64-bit for device), of which only the 2 device slices will be uploaded to the app store. Once there, Apple uses App Thinning to deliver only the required architecture to the user's device.

Additionally, if you are using a copy of the framework that includes bitcode, it will significantly increases the size of the framework, but not your app. Bitcode is used by Apple to recompile the binary on their servers with various optimizations, and it is not delivered to the user. (If you wish, you could remove the bitcode from the framework's binary using the command xcrun bitcode_strip -r PDFNet -o PDFNet, which will illustrate how much of the framework's size is due to bitcode.)

You can see the effects of the above for yourself by downloading our showcase app, Xodo. Xodo for iOS includes PDFNet for iOS, yet the total app size is only 76.8 MB for both architectures. The installed size on an iPhone X (which you can look up in Settings->General->iPhone/iPad Storage) is 43.7 MB (which also includes additional app code, image resources, etc.). You will see the same reduction in size when including PDFNet into your app.

If you are particularly concerned about the size of your app, you could consider using the static framework, which will only link in the classes required by your app. It takes a bit more work to set this up, and it will increase your compile times (due to the need to link), and it will not take advantage of the App Store's delta updates, but it will minimize the total number of bytes contributed by PDFNet. Doing this may save your app a few MB, depending on which PDFNet classes you are using.

Lastly, if you are not using any UI functionality from PDFNet (such as PTPDFViewCtrl), and want to absolutely minimize the size of your app, you could consider using the static framework's C/C++ interface, which will link less code than Obj-C/Swift, due to the fact that C/C++ use fewer dynamic function calls.

Get the answers you need: Chat with us