From f513b2b855d58034c36072a3f0be99dae83311ac Mon Sep 17 00:00:00 2001 From: Within Date: Sat, 21 Sep 2019 17:21:55 -0400 Subject: [PATCH] fix --- .../ComplicationController.swift | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Switch WatchKit Extension/ComplicationController.swift b/Switch WatchKit Extension/ComplicationController.swift index 81dc8bb..4d5dff9 100644 --- a/Switch WatchKit Extension/ComplicationController.swift +++ b/Switch WatchKit Extension/ComplicationController.swift @@ -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