Xcode 7
app size increase
iOS development
troubleshooting
app optimization

After switching to Xcode 7, app size grew from 9 MB to 60 MB, is there a fix?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

When developers make the switch to Xcode 7, many observe a significant increase in app size, soaring from a modest 9 MB to a whopping 60 MB. Understanding the reasons behind this growth and finding solutions is crucial for maintaining efficiency in app deployment and a seamless user experience.

Technical Explanation

The increase in app size when upgrading to Xcode 7 can be attributed to several factors:

  1. Bitcode Inclusion: Xcode 7 introduced Bitcode, an intermediate representation of your compiled code. The App Store processes Bitcode into machine code, optimizing it for the target device. While Bitcode has many advantages, such as improved optimization, it does increase the initial size of the app bundle.
  2. Asset Catalogs: Asset catalogs became more comprehensive with Xcode 7, accommodating multiple screen resolutions and device formats. While this ensures optimal display across all devices, it also contributes to the bloat.
  3. New API Support: Xcode 7 supports a broader range of APIs and frameworks, sometimes leading developers to integrate more features, which naturally increases app size.
  4. Embedded Resources: Each new version of Xcode, including Xcode 7, often includes updated libraries and resources that could also contribute to an increase in the app's footprint.

Fixes and Mitigations

While the increased app size may initially seem daunting, there are several strategies to mitigate this issue:

  1. Optimize Image Assets: Use vector images and assets, where possible, to reduce size. Leveraging tools like ImageOptim can also compress images without losing quality.
  2. Modular Code: Refactor your code to ensure that only essential components are included in the app bundle. Unnecessary libraries and resources should be removed.
  3. Enable App Thinning: Apple introduced App Thinning, which includes techniques such as app slicing, on-demand resources, and Bitcode. This ensures only necessary assets and code are downloaded and stored on the end-user device.
  4. Analyze Build Structure: Utilize Xcode’s archive tool to dissect your app bundle, identifying and removing unnecessary components. This can include unused architectures or symbols.
  5. Use of Third-party Analytics: While analytics are vital, using multiple third-party SDKs may increase app size significantly. Consider consolidating or selecting lightweight alternatives.
  6. Strip Unused Architectures: Use the `lipo` tool to ensure your app only contains the architectures necessary for your deployment targets.

Key Data Summary

FactorDescriptionSolutions
Bitcode InclusionIntermediate code for better optimization on App Store.Utilize sources, analyze if needed.
Asset Catalog ExpansionSupports multiple devices, increasing asset size.Optimize images, use vectors.
API and Library SupportExpanded Frameworks/API support leading to more features.Limit to essential libraries, modularize code.
Embedded ResourcesAuto-inclusion of new libraries with Xcode update.Analyze app package, remove unnecessary resources.

Additional Considerations

  • Testing and Profiling: After implementing optimizations, continuously test and profile your app to identify new areas for size reduction.
  • User Experience Considerations: Balance optimizations with user experience demands. Especially in regions with slower internet speeds, an app’s initial download size can directly impact user acquisition and retention.
  • Long-term Strategy: Consider a long-term strategy for managing app sizes, such as periodically reviewing asset catalogs, refactoring code, and staying updated with the latest Xcode features that could aid in size reduction.

In conclusion, while the leap in app size when transitioning to Xcode 7 can seem intimidating, understanding the underlying causes and employing targeted strategies can effectively mitigate the concerns. By leveraging both Apple’s and third-party tools, developers can maintain an optimal balance between feature richness and app size, ensuring a seamless user experience while keeping deployment overheads manageable.


Course illustration
Course illustration

All Rights Reserved.