---
title: "Complications bites - Little Bites of Cocoa"
description: "Little Bites of Cocoa about Complications: short tips and techniques for iOS and Mac development, each a brief explanation of one concept, technique or tool."
url: "https://littlebitesofcocoa.com/topics/41-complications"
author: "Jake Marsh"
---
# Bites about: [Complications](https://littlebitesofcocoa.com/topics/41-complications)

Topics

- [Apple Watch](https://littlebitesofcocoa.com/topics/8-apple-watch)
- [Complications](https://littlebitesofcocoa.com/topics/41-complications)

## [#21: CLKTextProvider ⏰](https://littlebitesofcocoa.com/21-clktextprovider)

 Monday June 22nd, 2015

Topics

- [Apple Watch](https://littlebitesofcocoa.com/topics/8-apple-watch)
- [Complications](https://littlebitesofcocoa.com/topics/41-complications)

**CLKTextProvider** is part of **ClockKit** in **watchOS 2**. It's an abstract base class of a family of classes that allow you to provide text content for a complication on Apple Watch. Visual space on the Apple Watch's screen is so constrained, that Apple has created a whole suite of classes for gracefully degrading the way values are displayed in complications, depending on how much space is available.

Essentially, you tell the class the value you want displayed, and the system handles formatting and best fitting the content for the constraints of the complication it's included in.

```swift
import ClockKit

let now = NSDate()
let units : NSCalendarUnit = [ .Weekday, .Month, .Day ]

let textProvider = CLKDateTextProvider(now, units)

// textProvider will now render one
// of these strings, depending on
// the environment its in:

// "Monday, June 22"
// "Mon, Jun 22"
// "Jun 22"
// "22"
```

In addition, **ClockKit** also contains text providers for many common values you might want to include in a complication such as:

- Dates/times like *"Monday June 22"* or *"10:09"*
- Relative dates/times including 3 different styles: Natural (*"2HRS 11MINS"*) , Timer (*"09:42"*), and Offset (*"+31 MINUTES"*)
- Time intervals like *"1:00-2:30PM"*

There's also a generic ‘simple' text provider for gracefully degrading your own custom text content.

**CLKTextProvider** (as well as the rest of **ClockKit**) is sadly only available in **watchOS** at the moment. It's such a great little set of utilities, here's hoping it makes it way into **iOS** and **OS X** at some point!

 

 
