Class

CLKDateTextProvider

A formatted string that conveys a date without any time information.

Declaration

@interface CLKDateTextProvider : CLKTextProvider

Overview

Use a date provider for strings that contain day, month, and year information. The text provider formats the date information consistently and in a way that makes the best use of the available space. It also takes into account the user’s region and locale settings.

When creating the formatted string, the date text provider creates the longest string that fits in the given space. It includes as many of the requested date elements as it can, but may truncate elements or use abbreviations as needed.

Date Format Options

When creating a CLKDateTextProvider object, you must specify which calendar units you want included in the resulting date. Only the following calendar units are supported:

All other calendar units are ignored.

When formatting the date, the date text provider drops units starting at the end of the preceding list and working up. In other words, it drops the year first, followed by the weekday information, followed by the month. For example, a text provider configured to display all units for the date December 28, 2014 in the English-US locale would remove elements as follows until it encountered a string that fit the available space:

  • Saturday, December 28, 2015

  • Saturday, December 28

  • Saturday, Dec 28

  • Sat, Dec 28

  • Dec 28

  • 28

Topics

Creating a Text Provider

+ textProviderWithDate:units:

Creates and returns a text provider with the specified date and the default time zone.

+ textProviderWithDate:units:timeZone:

Creates and returns a text provider with the specified date and time zone.

Getting the Date Information

date

The date to display.

timeZone

The time zone used in the formatted string.

calendarUnits

The calendar units to include in the formatted string.

uppercase

A Boolean value that determines whether the date string displays in uppercase.

Relationships

Inherits From

See Also

Data Providers

CLKImageProvider

An image displayed by a complication.

CLKFullColorImageProvider

A full-color image displayed by a complication.

CLKRelativeDateTextProvider

A formatted string that conveys the difference in time between the current date and a date that you specify.

CLKSimpleTextProvider

A single line of text to display in your complication interface.

CLKTextProvider

The common behavior for displaying text-based data in a complication.

CLKTimeIntervalTextProvider

A formatted time range.

CLKTimeTextProvider

A formatted time value.

CLKSimpleGaugeProvider

A gauge that shows a fractional value.

CLKTimeIntervalGaugeProvider

A gauge that tracks time intervals.

CLKGaugeProvider

An abstract superclass that provides all the common behaviors for the gauge providers.

CLKSimpleGaugeProviderFillFractionEmpty

A fill value indicating an empty gauge.

CLKGaugeProviderStyle

Visual styles available for gauges.