Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the ways to reduce bundle size on iOS?

Tags:

ios

I have some images which are huge in size and my bundle size currently is 70 MB. I think Xcode already runs the assets through png crush.

like image 319
shalzangel Avatar asked Dec 12 '25 11:12

shalzangel


2 Answers

  • Do not use any text images with useless effects, use UILabels instead.
  • Draw simple shapes and effects using CAShapeLayers instead of using images.
  • Use JPEGs instead of PNGs where you don't need transparency. (Actually file size depends on the image content here)
  • Use Save for Web option in PhotoShop or other tools to optimize PNG images.
  • Use sprites combined together instead of separate images.
  • Make sure you delete all unused resources.
  • Do not localize common parts of the images, localize only the different parts. (think of a background image with a small flag at the bottom for each locale. use one single bg image and separate flag images. localize flag images only, not the entire bg images with the flags.)
  • Use the same splash images for iOS7 and previous iOS versions. (You need to manually edit the JSON file in .xcassets)
  • Try using a CDN to download assets on the first launch.

In addition to images keep those in mind too:

  • Try replacing custom fonts with default system fonts if you don't need them really.
  • Use MP3 audio files instead of WAV files. (or other compressed formats)
  • Make sure you delete all unused 3rd party frameworks.
like image 176
erkanyildiz Avatar answered Dec 15 '25 00:12

erkanyildiz


You can try converting the images to jpg (if they don't have any transparent regions). Also try using http://imageoptim.com/

like image 22
anuj Avatar answered Dec 14 '25 23:12

anuj