Saturday, 27 February 2010

Using Javascript to do iPhone apps

Mobile Safari has got native-speed animations, a built in SQL-Lite database for client-side storage, local caching, access to touch events and more. And the great javascript programming language. You can do apps that feel and look like traditional apps, but with direct install from a website rather than through app-store. I recently did a proof of concept for a client that was very impressive. It felt just like a "real" app, with sweeping animations, touch events and more.

Here are some decision points to choose a strategy:

Code an app on the browser:

  • If you want to do something cheaper and faster.
  • If you don't want to publish it on app-store.
  • If you wan't to be able to upgrade it instantaneously.

Code an objective-C application:

  • If you like to do just as everyone else
  • If you want to do something in need of really high speed like a 3d game or a face recognition algorithm.
  • If you appreciate to have a for-profit organziation like Apple approving or disapproving what you have done.

Here are some links for developers that want to try the browser way:

Apple Safari Documentation

Safari Visual Effects Guide

The Touch-Event

A new O'Reilly book about this way to do apps, a very good introduction. It a bit thin on animations and events, so also read the Apple docs.

If you need to get on app-store or access even more native features, there is a project Phonegap that wraps some objective-C around your files. But first take a look at what you can do without it.

Some observations:

Mobile Safari is impressive, but WTF: You can't have scrolling inside a div. I wonder how they came up with the idea to remove that standard feature.

To get a logging facility, on your iPhone go to Settings > Safari > Developer > Debug Console. If you have a good development environment like emacs + flymake + jslint you don't feel the need of a real debugger that much anyway, print statements (logging) is an underrated technique.

No comments:

Post a Comment