<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "watchOS: 2.0.0 - 27.2.0"
  ],
  "documentType" : "symbol",
  "framework" : "ClockKit",
  "identifier" : "/documentation/ClockKit/CLKTextProvider/textProviderWithFormat:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "ClockKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CLKTextProvider(cm)textProviderWithFormat:"
  },
  "title" : "textProviderWithFormat:"
}
-->

# textProviderWithFormat:

Creates and returns a text provider built from the specified format string.

```
+ (CLKTextProvider *) textProviderWithFormat:(NSString *) format;
```

## Parameters

`format`

A format string to use when building the text provider. To insert content from another text provider into the string, use the `%@` placeholder. For more information and examples about the placeholders you can use in this string, see [Formatting String Objects](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/FormatStrings.html#//apple_ref/doc/uid/20000943) and [String Format Specifiers](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFStrings/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265). This parameter must not be `nil`.

## Return Value

A text provider object built from the specified arguments.

## Discussion

Use this method to create a text provider comprising text and the content of other objects, including other text providers.

### Set Up Multicolor Text

The graphic complications support multicolor text in some text fields. To create multicolor text, build a composite text provider using two or more text providers with different tint colors.

```objc
CLKTextProvider *energyTextProvider = [CLKSimpleTextProvider textProviderWithText:myMoveString];
energyTextProvider.tintColor = myEnergyColor;

CLKTextProvider *exerciseTextProvider = [CLKSimpleTextProvider textProviderWithText:myExerciseString];
exerciseTextProvider.tintColor = myExerciseColor;

CLKTextProvider *standTextProvider = [CLKSimpleTextProvider textProviderWithText:myStandString];
standTextProvider.tintColor = myStandColor;

NSString *separatorString = NSLocalizedString(MY_LOCALIZED_SEPERATOR, @"Seperator for compound data strings.");

CLKTextProvider *multiColorTextProvider = [CLKTextProvider textProviderWithFormat:@"%@%@%@%@%@",
                                           energyTextProvider,
                                           separatorString,
                                           exerciseTextProvider,
                                           separatorString,
                                           standTextProvider];

multiColorTextProvider.tintColor = UIColor.darkTextColor;
```

Tinted graphic complications flatten multicolor text, and display the text using the tint color selected by the user.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)