Apple last week announced the release of WatchKit, the SDK for its upcoming Apple Watch device. The SDK will allow developers to begin adding watch support to their iOS apps ahead of the device's launch in early 2015.
Initially announced at WWDC in June 2014 the Apple Watch runs on the new Watch OS. At the time of announcement details on this new operating system were limited, but with the release of the SDK the capabilities of the platform are now much clearer.
Existing applications will be able to integrate with WatchKit via three extension points:
- Glances - offer a quick view of focused data from an app. Unlike notifications, glances are pull based e.g. triggered by the user looking for information.
- Notifications - as with iOS these are push based alerts delivered to the device. They are further categorised as short and long look notifications. The short look notification is an abbreviated version of the long look notification. In privacy sensitive scenarios the short look notification is displayed e.g. when the device is locked.
- Watch App UI - Apple Watch apps are closely bound to a parent app running on an iPhone. The parent app contains a watch app bundle that is installed on the phone. This bundle contains the app resources - namely a storyboard and associated image files. The Watch App defers all complex processing to the phone app via extension APIs in the WatchKit SDK.
Whilst the WatchKit APIs resemble their AppKit counterparts, there are some performance related constraints. Developers integrating WatchKit into their applications should be conscious of the following differences:
- Interface Layout - AutoLayout is not supported for watch app user interfaces. Instead Apple have introduced a new 'group' layout system. Similar to Android's LinearLayout this supports horizontal and vertical stacking of controls.
- Custom Gestures - Apple have restricted developers to using only the default set of gestures supported by the device - swipe, tap and long press.
- Image Restrictions - Applications can store 20MB of resources on the watch. Apple recommends that developers place all images in the watch app bundle to reduce fetches from the phone.
- Native App Support - Developers must bundle their watch apps within existing iOS apps. In their announcement Apple did however allude to the fact that fully native apps would be supported "later next year".
Along with the SDK Apple has released a number of resources to assist developers in adding watch support to their apps:
- WatchKit Programming Guide - provides an overview on project structure, architecture and APIs for WatchKit apps and extensions.
- Human Interface Guidelines - outlines the UI elements and navigation flows supported by the device.
- WatchKit Catalog Sample - example Apple Watch application that illustrates the usage of notifications and glances. The app itself also demos the available collection of UI controls and the new group layout system.
Amongst the iOS development community the reaction to the release was favourable. In particular many prominent figures have expressed surprise at the capabilities of the platform. Both David Smith and Craig Hockenberry picked out custom app support as a key feature.
Members of Apple's iOS Developer Program can access the WatchKit SDK now via the iOS Developer Center. The SDK is bundled with the iOS 8.2 beta which also contains the Xcode 6.2 beta.