Keeping my head above water

When I was making plans to update Run 5k for the watchOS 2, my initial intent was to simply add support for heart sensor on Apple Watch and pretty much leave the rest of the app as it was. It’s pretty good as it is, with some platform-specific issues on the watch side which I expected to be resolved by simply having the app be standalone.

Doing the work though, I realized this will not really be possible. I need to re-write watch app from scratch and significantly update iOS app to properly support the running with watch as main device (more on that later).

Thus a major announcement: Run 5k v6.0 with support for iOS 9 and watchOS 2 will require Apple Health and require both Core Location and Motion.

First reason – watchOS 2 drastically changes things for developers. It’s not a mere update where you get to read heart rate sensor values like I currently do with external Bluetooth-based chest or wrist HR monitors. It’s integrated very much into the Apple Health workflows and you need to have the Health Workout session started and maintained throughout the run. For example: you can’t keep the (standalone) watch app running in foreground with watch screen off if you don’t use HealthKit. That alone requires pretty substantial rewrite.

Further, the way iPhone and watch app exchange data and where they actually communicate (in code) have also changed entirely, thus I can’t transfer the data from the iPhone to the Watch in the same way I did before. Hence, total rewrite.

Second – having a powerful watch app means that Run 5k is now two-headed beast. In watchOS 2, you can – as it looks to me at the moment – run and complete an entire session without the phone at all. And still have the distance, pace, heart rate data, calories etc; all except the track map. That opens up the issue of syncing data back and forth, maintain the progress on both ends etc. I’m still wrestling with details on how to approach this. But it’s an awesome new feature and any decent running app will have it. It’s not that I simply must add this feature to keep Run 5k relevant – I want it to be there.

What’s clear immediately though is that I will need to re-factor some of my oldest, most reliable code inside the iOS app to support this. Which would mean a lot of new testing if things stay as they are.

Third – and this a biggie – Run 5k is a very old app. Some parts of it are picked out from Run Mate, my very first iOS app I wrote back in 2009. That means that there are a lot of code I have kept in order to maintain compatibility with previous versions.

As iOS and iPhones have matured over time, I have added more and more options and combinations of options, as requested by people. Thus Run 5k now supports all kinds of ways to run: you can run with location tracking on/off, with motion tracking on/off, with/without background music. Run 5k had heart rate monitor support before Apple even announced HealthKit where you get it (almost) for free. You can have Apple Health turned on and off. You can have calories calculated. Or not.

On top of all that, now I have to shoehorn support for the Apple Watch.

After 4 years, I feel like I have created my own vast sea from which I can’t see the shore anymore. Sounds melodramatic but it really is overwhelming. I’m just a single guy doing this and Run 5k – as it is now – requires way more time than I can justify spending on it.

Hence the announcement from above: I will update Run 5k for iOS 9 and watchOS 2, but some corners have to be cut. Run 5k 6.0 will heavily leverage entire Apple Health platform. Which…has consequences.

How this impacts you

First, you really need to use Apple Health. Like, really.

  • If you don’t, you will no longer have distance, pace nor heart rate data measured in the app. Even if you are not using Apple Watch but 3rd party HR monitor, Run 5k will no longer see it on its own – all HR data will now come in from the HealthKit.
  • App will still do audio coaching in background on the iPhone (i.e. when screen is locked) if you have enabled Apple Health and/or have enabled Core Location. If you have none of those, I can’t guarantee that voice coaching will work in background.
  • On first start post-update, after you enable Apple Health, app will write all your existing workouts into it, so your running data will still be visible in the app.
    If you don’t enable it, there is no guarantee that your older running data will remain.


The most important benefit is that Run 5k will continue to thrive. I will be able to maintain it for the foreseeable future.

Next benefit is that run measures – like distance, pace and calories burned – will be much more accurate. So far, I have used my own algorithms for all of those. Many of those pre-date motion tracking (pedometer) on iPhone and Apple Health. I can’t possibly match Apple’s resources invested in their algorithms. Hell, I can’t even begin to think about matching what they do. And as such, values deviate here and there. Not by much, but they still do.

Apple have given me results of their hard work in the form of HealthKit framework and I would be foolish not to use it. Further, Health data is automatically shared between iPhone and Apple Watch and the data syncing – the hardest part in this whole situation – is solved by Apple. (or so I hope)

Those are primary reasons why I’m going full-speed-Apple-Health.

Glimpse into the future

These days I’m doing first test runs of Run 5k using nothing but the Watch. Not even the iPhone is present in this picture. In ideal scenario, you will need:

  • Your running clothes and shoes
  • Bluetooth headphones connected directly to the Apple Watch where you have previously synced some motivational music
  • Apple Watch on your wrist with Run 5k started
    and nothing else but nice weather.

Run 5k for watchOS 2 will tap your arm when you need to change pace during the training run thus not interrupting your music, ever. And at the end, you will see your results right on the watch app.

When you get home, you take the Watch off, place it anywhere close to your iPhone and while you shower all the data will be synced over. You can check your results in either Run 5k or in Apple’s own Activity app. Or in any other 3rd party app that’s leveraging Apple Health platform.

Here’s to the awesome future. Just few more months left.

Published on · apps