I’ve been lucky enough to get hold of an actual physical Apple Watch now since Friday. I’ve worn it over the weekend and of course, played around with building an application. One of the interesting things about the Apple Watch is that many of the apps built that were available on day 1 have never been run on real hardware, except perhaps, those built by friends of Apple like Twitter! Whilst this isn’t a definitive guide to the Apple Watch from a developer’s perspective, it is a list of questions I had and I’m sure others have! I also found a great Ray Wenderlich post with WatchKit FAQs. It’s worth noting that these are things I’ve found out so far, I could be wrong and it will probably change in the future!

Can I build a watch face?

No. You can customise them a bit. (There are literally thousands for the Pebble btw)

Can I access the force touch interaction?

No. You can assign a menu to it that can only include images and text.

Can I access the digital crown?

No. It controls scrolling by default and volume in the built in media player, but no API access so far.

Can I access the users Heart Rate?

No.

How does networking/communication work?

Ok, so this one is interesting... Your Apple Watch app acts like a separate process running on a separate device, however behind the scenes the OS runs a ‘skeleton’ like version of your host application on the user's iPhone and the Apple Watch extension in tandem, both on the iPhone. This is all magic but, from what I can tell, it’s actually used for complex view rendering, networking and file sharing which is then sent to the watch. This also explains why you can only update the UI of the Apple Watch with a user's interaction or by using a timer, as the watch will have to ask the phone for more information.

As the above image shows, your watch extension is actually running on the host iPhone with parts of the UI being rendered by the Apple Watch. This has some interesting side effects, for example an NSNotification (an event like API) cannot be sent between your watch extension and your host application, since even though they are theoretically running on the device they aren’t the same process. To communicate back and forth between the two processes Apple provides an API for asking the host process to do some work. If your host process needs to do some long running work like computation, fetching a user's GPS location or similar you have to declare that you’re running a background task. Interestingly however you can do pretty much whatever you want in the WatchKit extension, because it’s running on the phone. This piqued my interest as this includes networking, meaning I shouldn’t have to ask the host application to do various, though probably small, API requests and essentially avoids me having to get into RPC territory. Here’s an example Watchkit interface viewcontroller that implements WebSockets and doesn’t call back to the host application at all; I’m not sure WebSockets like this are a good idea, but it certainly shows what you can do!

Note carefully how I re-instantiate the WebSocket during view activation; whilst the code appears to be running on the iPhone, the process is not long lived. When the user looks away and their watch sleeps, your application is suspended and your view deallocated. Perhaps, then, a better solution for fast WebSocket like communication would be a long running socket in the host application with the Watch communicating with that application.

How does storage work?

An example I immediately thought of was building an audio player, but how can I download and stream a super long piece of audio and where is it stored? When viewing a list of Instagrams for example, where are those images downloaded to? Since your WatchKit extension and the host application are on the same device, Apple allow you to share files and user defaults (preference files) via a ‘secure container’. In a basic sense, this is a folder that both apps have read-write permissions on.

Can I haptic tap the user programmatically?

No. You have send a local notification at the moment.

What’s a Glance?

A Glance is basically a single view from your app that is ‘read-only’, any tap on a Glance opens the WatchKit application. Though some of Apple’s own Glances have interactions.

Can I build hybrid Apple Watch apps?

Well, not in HTML, since there’s no web view on the Apple Watch. However React Native and others are promising a generation of native code generating frameworks with a Javascript engine in the background that I suppose could run on the host application. So I guess it’s theoretically possible!

Can I build any custom UI I want?

No. This is a strange one. You can add images, buttons and other new WatchKit type interactions, but they’re laid out in a grid like fashion. At the moment there is no custom drawing framework or way of doing completely custom interfaces.

How do animations work?

There are none! However you can create a series of images and turn that into an ‘animation’ which I assume is for battery life reasons, quite clever if not a bit limiting.

Other notes