Last active
May 2, 2018 11:12
-
-
Save mlcollard/6f227fc64247a5ccfaa2d6c5a31d4831 to your computer and use it in GitHub Desktop.
iOS: Watch: Complications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call the handler with the current timeline entry | |
let template = CLKComplicationTemplateModularSmallRingText() | |
template.textProvider = CLKSimpleTextProvider(text: "UA") | |
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template) | |
handler(timelineEntry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch complication.family { | |
case .modularSmall: | |
print("HERE \(#function)") | |
let modularSmallTemplate = CLKComplicationTemplateModularSmallRingText() | |
modularSmallTemplate.textProvider = CLKSimpleTextProvider(text: "UA") | |
handler(modularSmallTemplate) | |
default: | |
handler(nil) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let template = CLKComplicationTemplateModularSmallRingText() | |
template.textProvider = CLKSimpleTextProvider(text: "1") | |
var timelineEntry = CLKComplicationTimelineEntry(date: Date(timeIntervalSinceNow: (60 * 60 * 1)), complicationTemplate: template) | |
template.textProvider = CLKSimpleTextProvider(text: "2") | |
timelineEntry = CLKComplicationTimelineEntry(date: Date(timeIntervalSinceNow: (60 * 60 * 2)), complicationTemplate: template) | |
handler([timelineEntry]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment