One Weird Trick to Lose Size
Ben Sandofsky

It’s worth pointing out that Xcode doesn’t actually do full pngcrush on PNGs included outside asset catalogs. Xcode calls its own build of pngcrush with parameters that just do an iOS “optimization” where it reorders the image data to be BGRA instead of RGBA, to make it ever-so-slightly faster to hand off to a UIImageView (which otherwise swaps the byte order on its own to make it more hardware friendly). It doesn’t do the full-fledged pngcrush that tries a bunch of different compression options and methods to see which one gets the smallest file.

You can turn this off in the build settings, and then run actual pngcrush on them (or better still, ImageOptim) like you would for the ones going into asset catalogs. As mentioned in the article, the file size savings will more than make up for the 1 millisecond lost when assigning the image to a UIImageView.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.