Type Method
型メソッド
explicit(_:)
A schedule for updating a timeline view at explicit points in time.
Parameters
パラメータ
dates
The sequence of dates at which a timeline view updates. Use a monotonically increasing sequence of dates, and ensure that at least one is in the future.
Discussion
議論
Initialize a TimelineView
with an explicit timeline schedule when you want to schedule view updates at particular points in time:
let dates = [
Date(timeIntervalSinceNow: 10),
Date(timeIntervalSinceNow: 12)
]
struct MyView: View {
var body: some View {
TimelineView(.explicit(dates)) { context in
Text(context.date.description)
}
}
}
The timeline view updates its content on exactly the dates that you specify, until it runs out of dates, after which it stops changing. If the dates you provide are in the past, the timeline view updates exactly once with the last entry. If you only provide dates in the future, the timeline view renders with the current date until the first date arrives. 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.
See Also
参照
Getting Built-in Schedules