Building iOS Web Apps in 2013

Benjamin De Cock,

When working for Stripe, I often felt limited by not being able to implement my own designs and to tweak UI behaviours by myself. I decided to fix that and to get a deeper understanding of JavaScript. And the best way to learn was in my opinion to code a real app. I developed (or, to be more accurate, rewrote) Doubbble as a side-project. I thought I could share my experience on developing a web app today for iOS.

TL;DR: iOS 6 brought many new great features for web apps, modern iOS devices are insanely fast and I now consider web apps to be a robust alternative to developing native apps.

JavaScript is remarkable in the way it lets novice developers build, quickly and easily, real, interactive stuff. The problem is that it's so easy to get started that most people tend to not put too much effort in writing efficient JavaScript. It often leads to unresponsive and clunky web apps and to the conclusion that the technology is just not ready yet. Just like with any other language, writing bad code obviously results in bad apps.

Writing decent JavaScript, however, can definitely result in native-like performance and smoothness. I'd even argue that when done right, a web app can be better than a native app as your users will always be running an up-to-date version of your app without any effort.

iOS 6 really is a game changer. (On a related note: if you still think Apple isn't doing any effort with web apps in order to promote its Store, it's time to reevaluate your point of view). In addition to the faster JavaScript engine, here are my 5 favorite new features iOS 6 provides for us:

  1. Safari's Web Inspector support
  2. camera access
  3. MutationObserver
  4. requestAnimationFrame
  5. CSS Filters

And you can obviously keep using all the great things already implemented in iOS 5 such as Web Workers (to keep the UI responsive while doing intensive operations) and App Cache (to run your app offline). It's also fairly easy to save the current app state using Local Storage so we can display the exact same view as the previous launch, including scroll positions and, for example, a piece of text being entered by the user. Really, there isn't much that prevents us from reaching a native-like experience.

The technology feels mature today. You have access to tons of APIs and since you're developing for one specific platform, you can probably avoid using any library which will obviously make the download and initialization times longer. Doubbble, for example, is just vanilla JavaScript (feel free to check the development code by browsing the sexy Apache listing btw). As a result, the execution is extremely fast and the whole code (not even gzipped) weighs only 20K -- in comparison, jQuery 1.9 alone weighs almost 100K.

Developing web apps for iOS today is just a fantastic experience. You have great tools, great performance and great resources, it's up to you to write great code and to care about the user experience. And if you do, I'd suggest considering web technologies for your next mobile app (be it only for the auto-update) unless you need OS-specific APIs, such as accessing the user's Contacts or sending push notifications. Happy coding!