MacKuba

🍎 Kuba Suder's blog on Mac & iOS development

WatchKit Adventure #0: Intro

Categories: Cocoa, WatchKit, iPhone Comments: 0 comments

Apple Watch

Ever since I saw the first Apple Watch announced on stage, I wanted to learn to write apps for it. I bought my first Watch half a year later, when they finally appeared in Europe, with that thought in mind. You can probably guess how that went…

I now have on my wrist my second Apple Watch (Series 1), bought two years ago after I smashed the screen in the first one. And to this day I haven’t written a single line of code for watchOS… This is actually one of many things that have been on my ToDo lists for literally years, that I often think about, but never actually find time to do. Procrastination is a terrible thing.

But I’m trying to fight it. So after going through a lot of docs and most of the WWDC talks about WatchKit more than once, it’s time to try it out in practice.

For a long time I’ve had an idea for a simple app in mind. I live in Kraków, a city that’s been kind of infamous in the recent years (maybe somewhat unfairly, because it’s a problem of whole Poland) for having a terrible smog during the colder months every year. A lot of people burn coal to heat their houses, often low quality coal or in low quality stoves, and some even burn literally garbage, with plastic and everything. And what makes things even worse is the unique geography of Kraków, which is located in a river valley surrounded by hills, which makes all polution slide down and stay inside, only pushed out periodically by stronger winds. This all results in pollution levels that in some Western European countries would trigger critical pollution level alarms on most of the winter days.

Due to a lot of campaigning by some activist groups, things are gradually improving, but slowly. For now, if you care about your health, or spend time outside e.g. jogging or commuting by bike, you need to have a filtering mask and know on which days to put it on.

Welcome to Krakow, the post-apocalyptic city where we organize fashion shows for anti-smog masks

You can imagine where this is going: it would be ideal to have a Watch app with a complication on the watch face that I could quickly glance on in the morning. That way, in literally a second – without the need to even open any app – I would know if the PM10 level today is e.g. 50 µg/m3 (officially at 100% the safety limit, but in Kraków considered “pretty good” in winter) or 150-200 µg/m3, which means I really need to put on the mask if I don’t want to feel slightly ill later.

There are of course many air quality apps available globally or made specifically for the Polish market (or even just for Kraków), but I’ve looked through them now and I could find only three that include watch apps, and none of them offers a complication. Also, I don’t fully trust those that aren’t made in Poland, because I don’t know how to read their data in the local context – like I mentioned, an “acceptable” level here could be considered “critical” elsewhere…

We have a pretty good local air monitoring system with several sensor stations from which you can easily download hourly data, so that would be enough. There’s also an independent system made by a private company Airly that has orders of magnitude more sensors and covers whole Poland – I might try their API later too, but let’s keep things simple for now.

Sample hourly PM10 chart for one day That was a really bad day – good thing I was in Spain then 😎

I want to do things slightly differently this time though. Instead of just working on an app in a private repo that perhaps no one except me will ever see, I want to try doing it in the open. I will have a link to an open repo here, and I also want to write about what I’m doing and learning as I go along, with a series of tutorial-like articles.

Yes, I know everyone has already given up on Apple Watch and WatchKit, everyone stops using it after a month, no one wants to make apps for it, really. It’s almost become a joke at this point. 1)

But I still believe that Apple Watch has a future. Just look at iOS 2 (or was it iPhone OS?) on iPhone 3G and compare it to iOS 12 on iPhone XS – it was obvious to me from the beginning that you shouldn’t judge the whole platform by any temporary hardware or software deficiencies of the first version. It’s not inherently an unusably slow device with a very limited OS and SDK – that’s just what they managed to do for v1, but it’s going to improve with every new hardware generation and OS release. It’s already a very different device than it was in 2015, with a much improved SDK, and it will get better.

Of course it will never be an iPhone replacement – people won’t spend hours looking at a 38mm screen, scrolling Facebook and Instagram feeds on it. That’s not the point – it has its specific uses and should be used for things that make sense there. It’s not meant to be a tiny iPhone.

I have no idea what will come out of this, it’s going to be a big experiment. Maybe I’ll give up after one or two parts, maybe I’ll find out that this somehow doesn’t make sense or is not possible to do this way for some reason. Maybe I’ll be forced to change plans and approach along the way, or go back and update previous posts. We’ll see. But I’m hoping that:

  • I’ll have some fun doing it and I’ll learn a lot
  • some other people learning WatchKit will be able to learn something from it too
  • and that by making this public I won’t be able to just stop as easily, which will give me motivation to continue and not forget about this for another year :)

I’ll try to post the first introductory part describing the OS and app architecture soon. Meanwhile, I leave you with one of my favorite Apple ads:


Project repository: https://github.com/mackuba/SmogWatch

Episode list:

#1: The Big Picture

#2: Minimum Viable Complication

#3: Building the App UI

#4: Tables and Navigation

1) This first post was originally written in April (look at the header photo again :), so before watchOS 5 and the Series 4 watch, but I didn’t have time to continue with the rest before WWDC. It’s not clear yet if the current renewed interest caused by the Series 4 release is something temporary or more permanent, and if it will finally bring back developers and watchOS versions of some popular apps. (Feb 2019 update: not really.) ↩︎


Leave a comment

*

*
This will only be used to display your Gravatar image.

*

What's the name of the base class of all AppKit and UIKit classes?

*