Are there any official examples of setting up a complication using localizableTextProvider(withStringsFileFormatKey:, textProviders:)? I can get the text provider to populate when producing a SampleTemplate, but whenever I try to generate a template using getTimelineEntries the text provider generated by localizableTextProvider the result is always blank, no text.Example (only supporting .utilitarianLarge):func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
// Call the handler with the current timeline entry
let template = CLKComplicationTemplateUtilitarianLargeFlat()
template.textProvider = CLKTextProvider.localizableTextProvider(
withStringsFileFormatKey: "testComplication",
textProviders: [
CLKSimpleTextProvider(text: "Hello"),
CLKSimpleTextProvider(text: "World")
]
)
handler(CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template))
}and sampleTemplate asfunc getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
// This method will be called once per supported complication, and the results will be cached
switch complication.family {
case .utilitarianLarge:
let template = CLKComplicationTemplateUtilitarianLargeFlat()
template.textProvider = CLKTextProvider.localizableTextProvider(
withStringsFileFormatKey: "testComplication",
textProviders: [
CLKSimpleTextProvider(text: "Hi"),
CLKSimpleTextProvider(text: "World")
]
)
handler(template)
default:
handler(nil)
}
}with ckcomplication.strings as"testComplication" = "%@ %@";The sample template will always display the text "Hi World", whereas the result from getCurrentTimelineEntry will always display an empty complication.Has anyone had luck composing text providers in this way?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Is it possible to add a watchOS target to the Multiplatform app template in Xcode? By default I only see iOS and macOS listed and when I try to add a watchOS target app I get a whole new App. Is this intended or am I missing some proper way to add a watchOS app?