Contents

init(date:style:units:)

Creates a text provider that shows the difference between the current time and the specified date.

Declaration

convenience init(date: Date, style: CLKRelativeDateStyle, units calendarUnits: NSCalendar.Unit)

Parameters

  • date:

    The date to use for calculations. This parameter must not be nil.

  • style:

    The style to use when formatting the relative date value. For a list of possible values, see Clkrelativedatestyle.

  • calendarUnits:

    The units to include in the resulting date string. For a list of supported calendar units, see Clkrelativedatetextprovider.

Discussion

This initializer produces a text provider that updates automatically as time passes. To create a text provider that produces a static, relative date, use init(date:relativeTo:style:units:) instead.

The text provider created by this method uses the default time zone information for the current user. The system formats date values according to the user’s current locale information.

See Also

Creating a Text Provider