A Plea for Better iOS Text Facilities

Awhile back, Jacqui Cheng from Ars Technica contacted a bunch of folks (including me) for a story she was putting together about what iOS devs would most like to see from Apple in 2012. Unfortunately I never got around to responding (sorry Jacqui–the holidays were crazy), but if I had, one item would have stood an order of magnitude above everything else on my list: better rich text formatting support in the middle layers of Apple’s development frameworks.

Now this may sound like a surprisingly mundane request considering the number of whiz bang things people are expecting from Apple in 2012, but if you’ve ever tried to develop a native iOS applications that present textual content downloaded from the Internet, you probably share my frustration. For a device that is generally taken for granted as the future of media, it’s surprising that the iPad offers app developers only two real options for displaying runs of styled text (e.g. text that contains sections of bold text, italic text, hyperlinks, different fonts, inline images, etc.): use CoreText, a very low level framework that essentially invites engineers to build their own text formatting engine; or resort to UIWebView, a heavyweight, almost completely opaque black box of a text view. It’s hard to go too far down the former path without essentially reinventing the web browser rendering engine, and if you choose the latter (more reasonable) path, you will likely end up spending a lot of your time trying to bend UIWebView to your vision.

Some (e.g. Facebook and Instagram) have dealt with this problem by abandoning fully native apps and instead building hybrid apps that rely on UIWebView for all but the simplest content presentation. Other, less ambitious companies have punted on the issue by essentially distributing 200 MB PDFs disguised as general purpose software. The really crazy ones, like Joe Hewitt with his Three20 framework, have essentially reimplemented their own rich text rendering frameworks, complete with CSS-like style functionality, but while I’ve certainly never been one to shy away from a megalomaniacal engineering challenge, I’m pretty sure that way lies madness for anyone without Apple-level engineering resources (it’s telling that Three20 was created by Facebook and even they are now relying on UIWebView).

What we really need is a facility that provides access to at least some subset of WebKit HTML rendering capabilities at a level between CoreText and UIWebView–something that doesn’t require developers to essentially re-invent HTML and CSS but allows them to render at least some level of HTML formatted text to a native view or layer without the overhead and inflexibility of UIWebView–basically, a next generation version of Mac OS X Cocoa’s NSAttributedString. I’m sure providing such a facility in the limited environment of the iOS presents significant engineering challenges, but Android has such an API, and I think the absence of such an API on iOS is holding the platform back as a media platform more than almost anything else I can think of.

Comments

627 Notes

  1. buzz posted this