swift - Can you extract the text from a CLKRelativeDateTextProvider? -
i'm building set of complications , have come clkcomplicationtemplateutilitarianlargeflat has 1 textprovider.
i want display text, along relative date. tried doing this:
let date = clkrelativedatetextprovider(date: nsdate(), style: style, units: units) let template = clkcomplicationtemplateutilitarianlargeflat() template.textprovider = clksimpletextprovider(text: "next: \(date)")
but is:
<clkrelativedatetextprovider: 0x79860b80>
can extract raw text clkrelativedatetextprovider or combine clksimpletextprovider in way?
pass in clkrelativedatetextprovider object format string, mentioned in apple's code:
@interface clktextprovider : nsobject <nscopying> // passing 1 or more clktextproviders in format substitutions, can add text around output of text provider. + (clktextprovider *)textproviderwithformat:(nsstring *)format, ... ns_format_function(1, 2); @property (nonatomic) uicolor *tintcolor; @end
here example:
id relativedate = [clkrelativedatetextprovider textproviderwithdate:[nsdate datewithtimeintervalsincenow:12 * 60] style:clkrelativedatestylenatural units:nscalendarunitminute]; template.textprovider = [clktextprovider textproviderwithformat:@"next: %@", relativedate];
the time shown in date provider still update time passes without having refresh anything.
Comments
Post a Comment