I created an app using Xcode's "iOS App with Watchkit App" template, went into TARGETS
and checked Complications Configuration > Supported Families > Graphic Corner
. I opened ComplicationController.swift
in the Extension and modified getCurrentTimelineEntry()
:
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
let cornerTemplate = CLKComplicationTemplateGraphicCornerStackText()
cornerTemplate.outerTextProvider = CLKSimpleTextProvider(text: "Outer")
cornerTemplate.innerTextProvider = CLKSimpleTextProvider(text: "Inner")
let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: cornerTemplate)
handler(entry)
}
I also modified getLocalizableSampleTemplate() to provide a sample, and this is not working either:
func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
let cornerTemplate = CLKComplicationTemplateGraphicCornerStackText()
cornerTemplate.outerTextProvider = CLKSimpleTextProvider(text: "Outer")
cornerTemplate.innerTextProvider = CLKSimpleTextProvider(text: "Inner")
handler(cornerTemplate)
}
When I run the app in the simulator or on my phone/watch and select the complication as one of the graphic corners, I expect to see "Outer" and "Inner". Instead it shows the name of my app for one and "---" for the other.
What am I doing wrong?