Skip to content

Instantly share code, notes, and snippets.

@mlcollard
Last active May 2, 2018 11:12
Show Gist options
  • Save mlcollard/6f227fc64247a5ccfaa2d6c5a31d4831 to your computer and use it in GitHub Desktop.
Save mlcollard/6f227fc64247a5ccfaa2d6c5a31d4831 to your computer and use it in GitHub Desktop.
iOS: Watch: Complications
// 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)
switch complication.family {
case .modularSmall:
print("HERE \(#function)")
let modularSmallTemplate = CLKComplicationTemplateModularSmallRingText()
modularSmallTemplate.textProvider = CLKSimpleTextProvider(text: "UA")
handler(modularSmallTemplate)
default:
handler(nil)
}
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