Skip to content

Instantly share code, notes, and snippets.

@itinance
Created April 15, 2019 11:04
Show Gist options
  • Save itinance/32b5573c04f0ad19861bcd4e21d52ee7 to your computer and use it in GitHub Desktop.
Save itinance/32b5573c04f0ad19861bcd4e21d52ee7 to your computer and use it in GitHub Desktop.
getLocalizableSampleTemplateForComplication
#pragma mark - Placeholder Templates
- (void)getLocalizableSampleTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
// This method will be called once per supported complication, and the results will be cached
if(complication.family == CLKComplicationFamilyModularSmall) {
CLKComplicationTemplateModularSmallSimpleText* template = [[CLKComplicationTemplateModularSmallSimpleText alloc] init];
template.textProvider = [CLKSimpleTextProvider textProviderWithText:@"10.000"];
handler(template);
} else if(complication.family == CLKComplicationFamilyModularLarge) {
CLKComplicationTemplateModularLargeTallBody* template = [[CLKComplicationTemplateModularLargeTallBody alloc] init];
template.headerTextProvider =[CLKSimpleTextProvider textProviderWithText:@"Header"];
template.bodyTextProvider = [CLKSimpleTextProvider textProviderWithText:@"test"];
handler(template);
} else {
handler(nil);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment