Search code examples
swiftwatchos-2apple-watch-complicationclockkit

Display heart rate via ClockKit complication?


I'm developing a watchOS app for tracking the heart rate, and it's working well.

Is it possible to display the computed heart rate value on a complication using ClockKit?


Solution

  • Is it possible? Yes.

    Is it feasible? Not really.

    Apple chose to provide a Heart Rate Glance instead of a complication, since complications aren't meant to be updated that frequently, and certainly not often enough to display an accurate heart rate throughout the day.

    Apple restricts scheduled complication updates to once every 10 minutes, so your displayed heart rate data would often be stale. While you could manually update your complication more frequently than that, you'll likely run into two issues:

    • Exhausting your complication daily time budget

      If you update your complication too often, and exhaust your daily budget, no further updates will occur for the remainder of the day. From the CLKComplicationDataSource Protocol Reference:

      Do not ask the system to update your complication within minutes. Instead, provide data to last for many hours or for an entire day. If your budget is exhausted, the next scheduled update does not occur until after your budget is replenished.

    • Draining your watch battery

      Frequent complication updates can drain the watch battery before the day is over.