This commit is contained in:
Cadey Ratio 2019-09-21 17:21:55 -04:00
parent 45b3791922
commit f513b2b855
1 changed files with 13 additions and 5 deletions

View File

@ -29,6 +29,10 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
// Call the handler with the current timeline entry
if (complication.family == .graphicCorner) {
handler(getEntryForGraphicCorner())
}
handler(nil)
}
@ -46,18 +50,22 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
// This method will be called once per supported complication, and the results will be cached
if (complication.family == .graphicCorner) {
handler(getTemplateForGraphicCorner())
handler(getTemplateForGraphicCorner("Example"))
}
handler(nil)
}
func getTemplateForGraphicCorner() -> CLKComplicationTemplateGraphicCornerStackText {
func getEntryForGraphicCorner() -> CLKComplicationTimelineEntry {
let gc = getTemplateForGraphicCorner(getFront())
return CLKComplicationTimelineEntry(date: Date(), complicationTemplate: gc)
}
func getTemplateForGraphicCorner(_ front: String) -> CLKComplicationTemplateGraphicCornerStackText {
let gc = CLKComplicationTemplateGraphicCornerStackText()
let front = "Cadey"
let text = CLKSimpleTextProvider()
text.text = front + " foo"
text.shortText = "hi"
text.text = front
text.shortText = ""
text.tintColor = UIColor.white
gc.innerTextProvider = text