Huge binary size overhead (~7MB) when integrating BoxSdkGen
- Dominant language
- Swift
- Stars
- 130
- Forks
- 111
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 13
Description
**### Is your feature request related to a problem? Please describe.**
Yes, the current SDK size is prohibitively large for lightweight iOS applications.
I conducted a clean experiment to measure the impact of `BoxSdkGen` on the final binary size:
1. Created a fresh, empty Xcode project.
2. Archived and exported the IPA (App Store Connect distribution).
3. **Result without SDK:** ~95 KB.
4. Added `BoxSdkGen` (via SPM), initialized a basic Client, and archived again.
5. **Result with SDK:** **~7.3 MB**.
An overhead of **7+ MB** just for adding the capability to interact with Box is excessive. Even with `Dead Code Stripping` and `Whole Module Optimization` enabled in Release mode, the SDK seems to pull in the entire dependency tree (likely due to the monolithic structure of `BoxClient` referencing all managers like AI, Sign, Shield, etc., which I do not use).
**### Describe the solution you'd like**
I would like to see a more modular approach to the SDK or a "Lite" version.
Ideally, I should be able to import only the modules I need. For example:
* `BoxSdkCore` (Auth + Networking)
* `BoxSdkFiles` (File operations)
If I only need to log in and download files, the linker should be able to strip out unrelated features like AI, Legal Holds, and Retention Policies. Currently, it seems the "God Object" architecture of the Client prevents effective stripping.
**### Describe alternatives you've considered**
Due to this size issue, I am forced to **remove the Box SDK entirely** from my project.
I am currently switching to a manual implementation using:
* `ASWebAuthenticationSession` for OAuth 2.0.
* Native `URLSession` for REST API calls.
This is a significant downgrade in developer experience, but necessary because I cannot justify adding 7MB to my app for just 3 basic features (Login, Folder Navigation, File Download).
**### Additional context**
* **App:** [[Anywhere Music Player](https://apps.apple.com/us/app/anywhere-music-player/id1669824656)](https://apps.apple.com/us/app/anywhere-music-player/id1669824656) (A lightweight music player).
* **SDK Version:** 10.3.0
* **Integration:** Swift Package Manager (SPM)
I have attached a sample project (`FatBoxSDK_Test.zip`) demonstrating this behavior. It contains the minimal code required to trigger the inclusion of the binary, resulting in the massive size increase.
[fat BoxSDK.zip](https://github.com/user-attachments/files/24882625/fat.BoxSDK.zip)
Contributor guide
Assessment
This issue has not been assessed yet.