Same issue with Xcode 14.2, any update?
Post
Replies
Boosts
Views
Activity
Please ignore this question, I need to re-check my code, it properly somewhere is wrong. I did a mini version app and it works fine.
@pdpoblivion Thank you for the reply.
I tried by providing 60 timeline entries, one for each minute, and refresh timeline after one hour. It's updating, but not very accurate, it has few minutes delay.
var updateDateTime = Date()
for _ in 1...60 {
		entries.append(TimelineEntry(date: updateDateTime, record: record))
		updateDateTime = Calendar.current.date(byAdding: .minute, value: 1, to: timelineDate)!
}
completion(Timeline(entries: entries, policy: .after(updateDateTime)))
Another way is provide one single entry for the timeline, and ask for refresh one minute later by using refresh policy .after(Date), it has few minutes delays to update as well. Anyway, from the tutorial, this policy is not for accurate update, it tells the earlier time that can refresh the timeline, so is the .atEnd policy.
It looks like Timeline is not a proper approach to achieve accurate time update. Maybe it's a timer inside widget view? Every widget app from app store, they can update time accurately, I think I must missed something.
Okay, it works with device, I think it's a bug on simualtor.
one way to achieve it is using Link:
ForEach(records, id: \.id) { item in
		Link(destination: URL(string: "wig://\(item.id)")!) {
				ZStack {
						// some views
				}
		}
}
Widgets support one widgetURL modifier in their view hierarchy. If multiple views have widgetURL modifiers, the behavior is undefined. @Claude31
Thanks for the reply, you are right.
The record is a list of data structure, with unique identifier for each record, like
struct UserRecord {
		id: String
		title: String
}
The deep link url looks like this: wig://1602639386. Manually open one url is working.
Hmmm, let me see if any other approach can achieve this.
what about an UIView contains repeatable animation? Snapshots won't work well.
No intent in timeline(for:with:completion:)
Same here, it's still happening with Xcode 12 Beta 3, for both simulator and deice.