TimelineView using ExplicitTimelineSchedule ignores last date?

Hi, everyone. I'm trying my first TimelineView with an explicit schedule, but my attempt – and even the simple example from the documentation – doesn't seem to work as documented. Here's what the documentation says an explicit schedule does:

The timeline view updates its content on exactly the dates that you specify, until it runs out of dates, after which it stops changing.

And it gives this example:

let dates = [
	Date(timeIntervalSinceNow: 10), // Update ten seconds from now,
	Date(timeIntervalSinceNow: 12), // and a few seconds later.
]

struct MyView: View {
	var body: some View {
		TimelineView(.explicit(dates)) { context in
			Text(context.date.description)
		}
	}
}

There are stipulations about what the view – which always displays some version of its content body – will do given only past or future dates, but it seems clear we should expect the view in this example to redraw at least once after it appears.

Here's the rest of the discussion from the documentation with my comments after testing what's stated:

If the dates you provide are in the past, the timeline view updates exactly once with the last entry.

That seems true, considering the "update" to be the initial draw.

If you only provide dates in the future, the timeline view renders with the current date until the first date arrives.

Not exactly: it looks the "date" property of the initial render is the (future) date of the first schedule entry, even though it's drawn early. When the first date does arrive, the body closure doesn't seem to be called. Only on the next date, if there is one, is it called again.

If you provide one or more dates in the past and one or more in the future, the view renders the most recent past date, refreshing normally on all subsequent dates.

That also seems correct, except…

… that in every scenario, the final date entry seems to be ignored completely! In other words, unless all date entries are in the past, the Timeline View stops before it runs out of dates. That documented example from the start, which we expect to redraw at least once after it appears? When I test it in a Playground, it appears, but doesn't redraw at all!

So, that's my main point of confusion after experimenting with TimelineView for the first time. I can achieve my own goal by appending an extra entry to my explicit schedule – even appending an entry identical to the previous "final" entry seems to work – but naturally that leaves me unclear about why I need to.

If anyone can tell me what I'm not understanding, I'd be grateful.

Replies

An update. I've tried building an running an macOS app using only that example code from the documentation. Not only does the last date have no effect, but starting at the time it's expected to have an effect, Xcode's debug dashboard shows the app's CPU usage jumping from about zero to about 7 percent and staying there indefinitely. Profiling this in Instruments and digging into the traces seems to indicate that AppKit might be perpetually attempting to animate something, but of course it's difficult to know more than that.

I can only conclude something's just really wrong with the TimelineView API when used with an explicit schedule. I'd love to hear any news or elucidation about this.