Class

CLKRelativeDateTextProvider

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

Declaration

@interface CLKRelativeDateTextProvider : CLKTextProvider

Overview

You use a relative date text provider to implement timers or other relative time values in an efficient way. Instead of using multiple timeline entries to replicate a countdown timer, create a single timeline entry with a relative date text provider. When the user views the clock face, ClockKit automatically updates the relative time value in your complication, providing up-to-date time information.

When creating the formatted string, the relative 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. The formatted string takes into account the user’s region and locale settings.

Date Format Options

When creating a CLKRelativeDateTextProvider 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.

The format of the relative time value is dependent on the date style you choose when creating the text provider. For a list of possible styles and examples of each, see CLKRelativeDateStyle.

Topics

Creating a Text Provider

+ textProviderWithDate:style:units:

Creates and returns a text provider with the specified date and style information.

Getting the Date Information

date

The target date to use for calculations.

relativeDateStyle

The formatting style to use for the relative time value.

calendarUnits

The calendar units to include in the formatted string.

Constants

CLKRelativeDateStyle

Constants indicating the formatting style for the relative date values.

Relationships

Inherits From

See Also

Data Providers

CLKDateTextProvider

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

CLKImageProvider

An image displayed by a complication.

CLKFullColorImageProvider

A full-color image displayed by a complication.

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.