diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-01-04 04:04:03 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-01-04 04:04:03 +0300 |
commit | bb32e56ca28bb43d5d5afef737f25e4725887725 (patch) | |
tree | 519388eb284adeb47744a9ebc334bdf9ff5444a6 /watchos/InfiniSolar/InfiniSolar WatchKit Extension/ComplicationController.swift | |
parent | d549f428cbbd54c49a90f92928e670d373c4a0d9 (diff) |
move watchos app sources here (which should be rewritten anyway, and usable only in very specific conditions)
Diffstat (limited to 'watchos/InfiniSolar/InfiniSolar WatchKit Extension/ComplicationController.swift')
-rw-r--r-- | watchos/InfiniSolar/InfiniSolar WatchKit Extension/ComplicationController.swift | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/watchos/InfiniSolar/InfiniSolar WatchKit Extension/ComplicationController.swift b/watchos/InfiniSolar/InfiniSolar WatchKit Extension/ComplicationController.swift new file mode 100644 index 0000000..7538d60 --- /dev/null +++ b/watchos/InfiniSolar/InfiniSolar WatchKit Extension/ComplicationController.swift @@ -0,0 +1,59 @@ +// +// ComplicationController.swift +// InfiniSolar WatchKit Extension +// +// Created by Evgeny Zinoviev on 03.08.2021. +// + +import ClockKit + + +class ComplicationController: NSObject, CLKComplicationDataSource { + + // MARK: - Complication Configuration + + func getComplicationDescriptors(handler: @escaping ([CLKComplicationDescriptor]) -> Void) { + let descriptors = [ + CLKComplicationDescriptor(identifier: "complication", displayName: "InfiniSolar", supportedFamilies: CLKComplicationFamily.allCases) + // Multiple complication support can be added here with more descriptors + ] + + // Call the handler with the currently supported complication descriptors + handler(descriptors) + } + + func handleSharedComplicationDescriptors(_ complicationDescriptors: [CLKComplicationDescriptor]) { + // Do any necessary work to support these newly shared complication descriptors + } + + // MARK: - Timeline Configuration + + func getTimelineEndDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) { + // Call the handler with the last entry date you can currently provide or nil if you can't support future timelines + handler(nil) + } + + func getPrivacyBehavior(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationPrivacyBehavior) -> Void) { + // Call the handler with your desired behavior when the device is locked + handler(.showOnLockScreen) + } + + // MARK: - Timeline Population + + func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { + // Call the handler with the current timeline entry + handler(nil) + } + + func getTimelineEntries(for complication: CLKComplication, after date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) { + // Call the handler with the timeline entries after the given date + handler(nil) + } + + // MARK: - Sample Templates + + func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) { + // This method will be called once per supported complication, and the results will be cached + handler(nil) + } +} |