John Scalo
19 December 2014
or, “The Honeymoon’s Over”
I actually didn’t get to work much on the watch app this week thanks to work on something that’s arguably an order of magnitude more huge (stay tuned for announcements about that…), but I figured doing our “glance” view should be a nice bite-sized bit of work that I could knock out in an hour or two. Right? Not so much.
Apple’s WatchKit is famously limited in what it allows us devs to do. Yet, up until now I celebrated those limits as liberating. If there’s only one way to do something then it’s easier to stay focused on that light at the end of the tunnel and keep moving forward rather than, say, iterating over dozens of UI mockups that aren’t going to be possible anyway.
Glances on Apple Watch sound like a great idea. Here’s how Apple describes Glances:
Since wristwatches were invented in the 19th century, people have been glancing at them to check the time. With Apple Watch, this simple, reflexive act allows you to learn so much more. We optimized your favorite apps for the wrist by developing Glances — scannable summaries of the information you seek out most frequently. To see them, you simply swipe up from your watch face. In an instant, you can glimpse the weather forecast, check out what’s next on your calendar, or find your current location on a map. You can quickly swipe through different Glances, or tap on one to go directly to its corresponding app for more details.
Clearly a Numerous glance would simply show one single number. With the UI already crystallized in my mind’s eye, I jumped into Xcode. Xcode gives you a default Glance UI to start with:
OK, this isn’t really what I want so I’ll just delete that group and… Oh. Hmm. For some reason, I can’t delete or move any of the default UI views from within Xcode. Thinking this was some sort of bug I actually banged my head on the wall for longer than I’d like to admit. The Apple Watch Programming Guide says nothing about it and I couldn’t find any mention of it in Apple’s dev forums. Finally I found a hint in the WatchKit HIG:
WHAT THE WHAT?! OK first, why is the HIG telling me how to use Xcode? Shouldn’t that be in the programming guide where I’ve been poking around all day? But whatever. More importantly, the glance UI design must come from a pre-set list of templates.
The cruel joke here is that it’s almost impossible to tell what the app is actually going to look like based on the textual description of the template in the menu. To Apple’s credit, in beta 3 of WatchKit they replaced the popup menu templates with graphical representations of the template UI:
Well that’s much better! Too bad beta 3 didn’t come out until after I was done cycling through every single one to see what it would look like 😞.
Speaking of WatchKit beta 3, Apple added another interesting touch: size classes for every single attribute associated with each WatchKit view.
While the prospects of what this means for future development are slightly terrifying (I would hate this for iOS), it’s actually great for me because I can stop resizing things in code and there are (currently?) only two sizes to choose from.
Up until now I’ve focused on the UI. A cached version of the numbers show up on the watch but after that they don’t update again until the iOS app writes out a new cache. This week I fixed that— numbers now update each time the watch app activates.
Another item on the to-do list for the week was Apple Watch settings. You see, while some people only have a few numbers, others have lots. I have 30 or so. So the question arises: do users want all of these numbers on their Apple Watch, or only some subset? For the Today view widget we decided to add prefs to the iOS app so that users can choose which numbers show up there. If it makes sense for the Today view then it probably makes even more sense for the Apple Watch. Additionally, the user will need a place to select which number shows up in the Numerous glance. I’m happy to say we now have a fully functional settings UI.
Lastly, we face a challenge with numbers that get their data from the phone itself. Namely: elevation, distance, steps, and HealthKit. The APIs backing each of these simply isn’t supported with WatchKit. Luckily in WatchKit beta 2 Apple added a new API that solves the problem:
This is actually incredibly awesome and shows that Apple listens to its developers and can still move swiftly. And it means that the Numerous watch app can simply “wake up” its parent iOS app, ask it to fetch the latest number steps, its location, etc, and send those values back to the watch app.
And that’s all for Apple Watch this week! Happy holidays and see you back next year!