(image source: Apple Press Info)
Woo-hoo! WatchKit has been released! This allows developers like myself to start developing apps for the Apple Watch, which will be available for sale in early 2015.
I'm super excited about WatchKit and have managed to find the time to play around with it. This is my learning journal.
Sample Watch App - Lister
It’s probably easiest to start by looking at examples. So I did that. Let me introduce you to Lister - Apple’s Hello World for Apple Watch.
What does it demonstrate?
- A working Watch App.
- Synchronising data between Watch app and its containing iPhone app, via App Groups and iCloud Document Storage.
- Using framework to share common code between multiple targets.
Points to note:
- You need Xcode 6.2 beta to run it.
- You also need to have a paid iOS Developer Program Account to run it, because it uses the App Groups entitlement to share data between the iPhone app and the Watch app.
- On initial run, there is a fatal runtime error “The shared application group container is unavailable. Check your entitlements and provisioning profiles for this target. Details on proper setup can be found in the PDFs referenced from the README.". Don’t worry, as it said just follow the instructions in the readme file and you will be able to run it.
Watch Apps needs iPhone
"Apple Watch requires the presence of an iPhone to run third-party apps." - WatchKit Programming Guide
You can consider Watch apps as an extended user interface of iPhone apps. Each Watch app must have a containing iPhone app. Apple said this may change later next year so that Watch apps become "native" and able to run on their own.
This is how components in Watch and iPhone work together:
Apple Watch iPhone ------------------ ------------------- Watch App WatchKit Extension <- You write these | | | bluetooth | WatchKit <-------------> WatchKit <- Apple framework
- Watch App is "dumb" - it is only a collection of static resources such as storyboard files and images.
- WatchKit Extension is the brain of Watch App and runs on iPhone.
3 Entry Points for Interactions
Users can interact with a Watch app through these entry points:
- WatchKit Apps (also known simply as Watch Apps in some of Apple docs) - This is what user gets when he or she taps on your app icon in the Apple Watch home screen.
- Glances - A series of one-screen summary that user can access quickly from the home screen in Apple Watch. Each Glance provides concise information for one app and works as a shortcut to it.
- Actionable Notifications (also simply known as Notifications in some of Apple docs) - Much like notifications on phone, but these appear on the watch instead.
Find out how your app should utilise these channels from the Apple Watch Human Interface Guidelines.
It is Primitive (now)
Isn't Apple Watch a masterpiece of advanced technology? The watch may be advanced, but the toolset Apple makes available for developers is primitive. At least for now.
- There is only one way to create animation - by specifying a sequence of images and optionally a repeat count. Sounds like an idea from... last century?
- There are only two types of navigation available to Watch apps, either Hierarchical (think UINavigationController in an iPhone app) or Page-based (think UIPageViewController). And you can't mix them. A Watch app uses one or the other.
- Watch apps rely on an iPhone app as its "base".
I'm not too disappointed. Maybe a little. Consider that this is just the very first generation of software and hardware, it makes a lot of sense to keep things simple.
As time goes by, I'm sure the battery, procesisng power, and network capabilities will grow, and these limitations will be lifted. Eventually.
Some Terminologies are Confusing
That's my first impression. It gets better after a while:
- App Extension - iOS features that allow your users to interact with your app, without opening your app itself.
- Watch App - Same as WatchKit App.
- WatchKit - The iOS framework that contains classes your project can use to create apps to run Apple Watch.
- WatchKit App - The component you create that runs on Apple Watch.
- WatchKit Extension - The component you create that runs on iPhone and works as the "brain" for your WatchKit App.
- Glance - A summary screen of your Watch App that user can quickly access. Also works as a shortcut to your Watch App.
Did you find this useful? Share with your friends and colleagues. Sharing is caring, and a huge motivation for me to write more!