Instance Method

getTimelineEntries(for:after:limit:withHandler:)

Retrieves future timeline entries for the complication.

Declaration

optional func getTimelineEntries(for complication: CLKComplication, after date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void)

Parameters

complication

The complication tied to the request. Use the complication family information in this object to determine which set of templates are valid.

date

The starting date for providing future entries. The dates for your timeline entries should occur after this date and be as close to the date as possible.

limit

The maximum number of entries to provide.

handler

The handler to execute with the future timeline data. This block has no return value and takes the following parameter:

entries

An array of CLKComplicationTimelineEntry objects representing the future data. The number of entries in the array must be less than or equal to the value in the limit parameter. If you specify nil, ClockKit doesn’t try to extend the timeline further.

Discussion

Use this method to build an array of timeline entries with your app’s future data. Each timeline entry contains the data and the date at which that data is valid. Don’t provide entries that occur before the date in the date parameter, and limit the number of entries you create to the value in the limit parameter.

The array you return must start after the date specified in the date parameter and extend forward in time. Each successive entry in the array must come after the one before it. Entries must be greater than one minute apart. If two entries are less than one minute apart, ClockKit discards one of the entries.

Don’t include the current entry in your array. That entry is retrieved separately using the getCurrentTimelineEntry(for:withHandler:) method.

If you don’t implement this method, ClockKit doesn’t try to add later entries to the timeline.