WatchKit Is Here! Creating Apps for the Apple Watch
As promised, Apple has delivered its first version of WatchKit, which allows you to create apps for the upcoming Apple Watch. In a surprising move, Apple released information regarding its new WatchKit in a web page open to the general public.
New Information on the Apple Watch
In the information that Apple has made publicly available, here are some new things we have learned about Apple Watch:
The main part of a Watch App runs on the iPhone, not the Apple Watch! You deliver a Watch App within your iPhone App.
There are two parts of a Watch App are:
WatchKit Extension – This is the main app that actually runs on the iPhone.
User Interface – The app’s user interface is installed on the Apple Watch.
When a user launches your app on Apple Watch, the associated WatchKit extension is launched in the background on the iPhone.
The 38mm watch is 272×340 pixels and the 42mm watch is 312×390 pixels, which makes them Retina-quality.
Apple created a new San Francisco font specifically for legibility on the Apple Watch.
You can change the default font size on an Apple Watch.
When a notification is sent to Apple Watch, the wearer first receives a short-look notification containing a minimal amount of information. If the wearer keeps their wrist raised during a short-look notification, after a moment, it turns into a long-look notification, which contains more detailed information.
Even if you haven’t built a Watch App yet, wearers can still receive notifications on Apple Watch from your iOS apps.
Instead of referring to Watch App “users”, Apple refers to them as “wearers”. This is an important mind-set for developers to remember as they create Watch Apps.
It will be interesting to see how consumers respond to this iPhone / Apple Watch connection, and how well the link between the two devices works.
3 Ways to Interact With Apple Watch
There are three main ways your iOS app running on an iPhone can interact with Apple Watch:
WatchKit Apps – Your create a user interface that is installed on the Apple Watch that the wearer interacts with. The wearer can manually launch the app from the Home screen of their Apple Watch.
Actionable Notifications – Your app can send notifications the wearer can respond to by selecting an action, which can transition them to a specific area of your Watch App, or viewed later in Apple Watch Notification Center.
Glances – You can provide read-only alerts, which gives users an abbreviated view of important information in your app.
Architecture
The Watch app is comprised of these two main pieces, one that runs on the iPhone and another on the Apple Watch:
The WatchKit Extension runs on the iPhone. It executes code in response to user interactions on Apple Watch.
The Watch App’s user interface is located on the Apple Watch. It’s loaded from a bundle containing your storyboard, images and other resources.
When the wearer views your Watch App, Notification, or Glance, Apple Watch loads the appropriate interface. It communicates with the iPhone and tells it to run your WatchKit extension.
As the user interacts with the Watch App, Apple Watch and iPhone send information back and forth. User interaction on Apple Watch, causes code to be executed in your WatchKit extension on the iPhone. Your code on the iPhone updates the Watch App user interface and performs tasks related to providing data to the Watch App.
Watch Apps in Xcode
You need to get Xcode 6.2 beta from the iOS Dev Center in order to create Watch Apps.
To create a Watch App, you add a new Watch App target to your existing iOS app. Your iOS app installs and manages your Watch app. You use the same familiar Xcode tools such as storyboards and code editors to design a Watch App.
The iOS Simulator allows you to view and debug your Watch app. To view the Watch App in the Simulator, select one of the Apple Watch options in the Simulator’s Hardware menu. You can even test and debug custom notifications in the iOS Simulator.
WatchKit Framework
There are a variety of UI elements in WatchKit framework that you can incorporate in your Watch Apps. Here are some of the controls highlighted by Apple:
Dates and timers update their values dynamically. Once set, these objects run autonomously on the Apple Watch and do not need additional intervention from your WatchKit extension on the iPhone.
The Map control is a non-interactive version of the standard map interface. You create a map snapshot in your WatchKit extension on the iPhone and send it to the Apple Watch for display. When the user taps the map control, it takes them to the Maps App on the Apple Watch.
A wearer displays a menu in your app using a force touch gesture. A menu can contain one to four items and each menu item consists of an icon and a label (the label can contain two lines of text).
Where to Learn More
I’ve just touched the surface of all the information Apple has released about Apple Watch Apps. To find out more, check out this link, which includes a 27-minute video that provides an overview of the development process. I’m looking forward to diving in and will be writing more about WatchKit in this column!