Saturday, June 13, 2015

Apple Needs to Thin Out The PNGs

Had a pleasant time at WWDC. As is my habit, I spent most of my time in the labs going over every issue I had that had vexed me. One of the highlights were some soon to be released improvements to my SVGgh rendering library to allow live updating in Interface Builder via support for the IB_DESIGNABLE switch. It took effort, but I finally beat my project into shape, got rid of the old fashioned static library, and was magically playing with showing SVGs inside of IB, and playing with my various button themes. Seeing that first image for the first time was sweet. Also got an assist with some long term problems with rotated gradients, and some pointers about text on a path.

But it also reminded me of how obnoxious Apple's reliance on fixed size PNG bitmap assets has become. The iPhone 6+ brought a need for a 3rd image resolutions, and the possibility of responsive design brings a preference for even more. I spent a couple hours slicing together the 30 PNGs I needed for use with a UISegmented control last week. I have better things to do. Apple added support for dropping a PDF into assets last year, but that just automates the process of making a bunch of bitmaps. And bitmaps are bulky, to the point that Apple will be automatically culling unnecessary ones out before installing them on user's devices

I find my own workflow of generating SVG artwork to be much more satisfying. They match up well with the simple, clean themes encouraged since iOS 7. They are less bulky and I typically only need one image per button. I can even use the 'currentColor' property to manipulate pressed and unpressed states from Interface Builder. I can use SVG's 'non-scaling-stroke' vector-effect to keep outline strokes to be 1 pixel wide regardless of scale. And with responsive design, I can use auto-layout to make my view elements whatever size I need without having to worry about scaling issues.

I would not be surprised if Apple were to support either an existing vector format, or perhaps a new one with size hinting in some future version of UIKit. It's past time.