Open Search

A complication with Clockkit complications

January 11, 2016 1:43 pm
Categorised in: ,
Reading Time: 2 minutes

I’m currently messing around creating complications for an IOS/watch app I’m building. One thing that I’ve found particularly weird given the number of templates available is that you can’t overlay text over an image on the fly. You can do a lot of other layouts, but you can’t do that.

One potential reason I can see for this is ensuring text doesn’t overlap the edges of the artwork in the background and then bleed onto the actual watch background. With no inset padding control, there is no way to guarantee this won’t occur and if I was Apple, the one place I don’t want the Watch software  to look broken EVER is on the actual watch face.

So how do Apple achieve something like the moon phase complication?

Seems if Apple are using the same templates as us they must be using something like CLKComplicationTemplateModularSmallSimpleImage and then based on moon phase data they are matching the phase to a particular pre-built image set and showing that on the complication. So they have ~28 moon images waiting on the Watch and pull from the right one on the refresh. This works great for something with a limited number of steps however creating a thermostat complication you would need an image for each potential temperature.

So whilst achievable it’s a lot of images to transfer across at app install time. Just considering celcius I’d want to capture 0°-30° positive temperature and down to -10°  on the minus side. So 40 individually created images to set and test if we are just using this technique with CLKComplicationTemplateModularSmallSimpleImage at 42mm. Of course if you were to use this technique for other complication templates you’d have the same again and then you have the sizes for the 38mm which are technically 4px smaller. Apple prefers correctly sized images to limit performance hits from resizing images.

Thank god I don’t consider fahrenheit a real measure of temperature otherwise you are looking at double that amount again!

Time is precious, what to do?

There is obviously a time implication here in terms of set up and build, but it just doesn’t feel robust. Like, Apple probably should have a CLKComplicationTemplateModularSmallComplexImage template available at WWDC 2016 so a lot of time would be wasted here implementing all these images. Especially if another template is a few months away and one of the existing templates can plug a gap (if not fitting YOUR vision)

I will say it is bloody weird that one of the templates doesn’t allow for text directly over an image. Roll on WatchOS 3?

*Update 28/01/16 Barbecuesteve in the comments of this post on Big Nerd Ranch suggests that this could be created using core Image to comp the images together as and when required but advises their may be a performance hit

This joint was penned by @elmarko