getLocalizableSampleTemplate(for:withHandler:)
Gets a localizable template that shows sample data for the specified complication.
Declaration
optional func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void)optional func localizableSampleTemplate(for complication: CLKComplication) async -> CLKComplicationTemplate?Parameters
- complication:
The complication tied to the request. Use the complication family information in this object to determine which set of templates are valid. For example, if the complication family is Utilitarianlarge, you’d instantiate the Clkcomplicationtemplateutilitarianlargeflat class for your template.
- handler:
The handler to execute with the template. This block has no return value and takes the following parameter:
- template
The template object containing your placeholder data. The data in this template is cached and displayed for your complication.
Mentioned in
Discussion
The system calls this method once per supported complication when your extension is installed, and the results are cached. In your implementation, instantiate the appropriate template class and populate the resulting object with localized data. The data you supply should be fake, but it should reflect what your complication would normally look like.
If you pass nil to the handler, the system generates a default placeholder template from your app’s icon and name.
See Also
Related Documentation
localizableTextProvider(withStringsFileTextKey:)localizableTextProvider(withStringsFileFormatKey:textProviders:)localizableTextProvider(withStringsFileTextKey:shortTextKey:)
Deprecated methods
CLKLaunchedTimelineEntryDateKeyCLKLaunchedComplicationIdentifierKeygetComplicationDescriptors(handler:)handleSharedComplicationDescriptors(_:)getPrivacyBehavior(for:withHandler:)CLKComplicationPrivacyBehaviorgetAlwaysOnTemplate(for:withHandler:)getTimelineEndDate(for:withHandler:)getCurrentTimelineEntry(for:withHandler:)getTimelineEntries(for:after:limit:withHandler:)getTimelineAnimationBehavior(for:withHandler:)CLKComplicationTimelineAnimationBehaviorgetSupportedTimeTravelDirections(for:withHandler:)CLKComplicationTimeTravelDirectionsgetTimelineStartDate(for:withHandler:)