Help with gaugeProvider.style

Hi,

Can someone out there give me an example of how to use this? Im playing around with some of the new gauges on series 4.

What I have so far:


CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText *template = [CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText new];

template.centerTextProvider = [CLKTextProvider textProviderWithFormat:@"hello"];

template.bottomTextProvider = [CLKTextProvider textProviderWithFormat:@"world"];

template.gaugeProvider.style = NO_IDEA_HOW_TO_USE_THIS

handler(template);


Thanks for any help.

Replies

CLKGaugeProvider is an abstract superclass. Instantiate your own gauge provider and assign it. https://developer.apple.com/documentation/clockkit/clkgaugeprovider


You can create one (example):

CLKGaugeProvider *gauge = [CLKSimpleGaugeProvider gaugeProviderWithStyle:CLKGaugeProviderStyleFill gaugeColor:[UIColor cyanColor] fillFraction:0.6];
CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText *template = [CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText new]; 
template.centerTextProvider = [CLKTextProvider textProviderWithFormat:@"hello"]; template.bottomTextProvider = [CLKTextProvider textProviderWithFormat:@"world"]; 
template.gaugeProvider = gauge; 
handler(template);