47.5 Widget Timeline Entries
The purpose of a widget is to display different information at specific points in time. The widget for a calendar app, for example, might change throughout the day to display the user’s next upcoming appointment. The content to be displayed at each point in the timeline is contained within widget entry objects conforming to the TimelineEntry protocol. Each entry must, at a minimum, include a Date object defining the point in the timeline at which the data in the entry is to be displayed, together with any data that is needed to fully populate the widget entry view at the specified time. The following is an example of a timeline entry declaration designed for use with the above entry view:
struct WeatherEntry: TimelineEntry {
var date: Date
let city: String
let temperature: Int
}
If necessary, the Date object can simply be a placeholder to be updated with the...