48.9 Modifying the Widget Provider
When the widget extension was added to the project, Xcode added a widget provider to the WeatherWidget.swift file. This declaration now needs to be modified to make use of the WeatherEntry structure declared in the WeatherData.swift file. The first step is to modify the getSnapshot() method to use WeatherEntry and to return an instance populated with sample data:
.
.
struct Provider: IntentTimelineProvider {
func getSnapshot(for configuration: ConfigurationIntent, with context: Context, completion: @escaping (WeatherEntry) -> ()) {
let entry = WeatherEntry(date: Date(), city: "London",
temperature: 89, description: "Thunder Storm",
...