I am building watchOS complications and i want to have a timer that counts down what i have made using the following:
func createUtilitarianLargeTemplate(prayer: Prayer?) -> CLKComplicationTemplate {
let myComplicationTemplate = CLKComplicationTemplateUtilitarianLargeFlat()
let dateProvider = CLKRelativeDateTextProvider()
if let prayer = prayer {
dateProvider.date = prayer.prayerTime.prayerDate
dateProvider.calendarUnits = [.hour, .minute]
dateProvider.relativeDateStyle = .timer
}
myComplicationTemplate.textProvider = dateProvider
return myComplicationTemplate
}
But i want to show some text next to the timer in an UtilitarianLarge
complication family. How is that possible as i can't set text in the dateProvider
.
What I want to achieve is the following String:
GBT * 15:24:12
So I want to have "GBT * " in front of the timer. How is that possible? Somehow it must be possible as I have seen other complications on the Appstore achieving this
It took them until watchOS 6 to add init(format:_:) to CLKTextProvider.
For watchOS 5 and prior, this is the only good way to do it...