Framework Size
You might be wondering why PSPDFKit.xcframework
is more than a few hundred MB in size. This can be irritating at first, especially considering that Apple only allows downloading apps over cellular data if they’re smaller than 100 MB. However, this isn’t the size your users will get.
The PSPDFKit SDK covers most of the PDF specification, which contains thousands of pages and is therefore quite complex. PSPDFKit includes a complete PDF renderer, cryptography features, and many UI components. This results in a lot of code and a sizable binary, although there are certain factors that make it appear larger than it actually is. We’re working hard to ensure the framework size stays as small as possible.
Architectures
The SDK binary includes slices for x86_64 and 64-bit ARM for iOS devices, Simulator, and Mac Catalyst. Each slice is a full and complete copy of the SDK, and only one slice is required for your users.
App Thinning
Apple also actively works on reducing app binary size and added app thinning in iOS 9. This creates optimized versions of your app, and the user only downloads the architecture required for the current device, resulting in a total SDK footprint of about 20–30 MB.
If you click on App Store File Sizes in the Compressed File Size column, iTunes Connect shows size estimations for each device in the detail view of your uploaded binary.
Adobe Character Maps
The PDF specification requires us to embed a sizeable list of character maps that add a few megabytes per architecture to ensure that text in PDF form can be converted to Unicode to make search and text selection work as expected. This is required for many documents, and it is especially important for decoding documents with CJK characters. We already optimize these character maps into a more efficient binary format to save both CPU time and size compared to the raw text version. (See this repository to get an idea of how a subset of character maps looks unprocessed.)
Rendering PDFs
Rendering PDF documents is a complex task, so we have a separate guide explaining some of the challenges.
Resources
PSPDFKit needs various images, localization files, and other resources. The images are highly optimized to take up as little space as possible.
dSYM
We also ship the .dSYM
files as part of our distribution. These folders are optional, but they help with crash symbolication. They’re solely intended for your company and Apple or a third-party crash reporting framework such as Crashlytics. These files are quite big, and if you follow our integration guide, they won’t be part of your application. If you do Enterprise installs, you don’t have the App Store thinning/stripping logic that would strip out unneeded parts — in that case, manually deleting dSYM
files will save some space. There’s also no damage if you leave it in — its removal is purely a size optimization.
Static Framework
In versions of PSPDFKit for iOS prior to 5, we primarily offered a static library that looked like a framework. This was the only way to distribute binaries at the time. With iOS 8, Apple added support for dynamic frameworks, and in PSPDFKit 4 for iOS, we offered both variants. Dynamic SDKs are slightly more complex in their setup (mainly due to a bug/design flaw in Xcode that does not automatically strip Simulator slices). However, they do offer significant advantages: Link time is reduced since the linker doesn’t have to merge your application binary with our SDK binary; stack trace symbolification works better since the .dSYM
does not change for PSPDFKit itself; and two-level namespacing ensures there are no symbol conflicts with your code. The main reason we offered both variants in PSPDFKit 4 was iOS 7 compatibility. With PSPDFKit 5, we dropped that, and with it, the static SDK version.
Delta Updates
Since iOS 7, Apple has been using delta updates on the App Store so that updates don’t download files in the application bundle that have not changed. With PSPDFKit 5 for iOS, we switched to a dynamic framework, which means our framework will not be downloaded again if your app update does not update PSPDFKit itself.
GitHub
GitHub has a hard limit of 100 MB per file, which prevents the framework from being checked in. We offer a few different solutions if you’re running into this issue.