I'm working on a timer app for Apple Watch and would like to provide a circular complication with the remaining duration of a timer.
Here is some example code, which you can preview in Xcode 12:
import ClockKit
import SwiftUI
struct CircularSmallComplicationTemplate {
let text: String
func make() -> CLKComplicationTemplate {
let textProvider = CLKSimpleTextProvider(text: text)
return CLKComplicationTemplateCircularSmallRingText(textProvider: textProvider, fillFraction: 1.0, ringStyle: .closed)
}
}
struct CircularSmallComplicationTemplate_Previews: PreviewProvider {
static var previews: some View {
CircularSmallComplicationTemplate(text: "5:00").make()
.previewContext()
}
}
ClockKit applies the default text size, which causes text with more than three characters to truncate:
I wonder if it is possible to shrink the text to fit inside the circle? I know that I could also use SwiftUI to draw the content, but this is only supported for the Graphic
complication slots.