51.3 Modifying the Widget
With the intent configured, all that remains is to adapt the widget so that it responds to location configuration changes made by the user. When WidgetKit requests a timeline from the provider it will pass to the getTimeline() method a ConfigurationIntent object containing the current configuration settings from the intent. To return the timeline for the currently selected city, the getTimeline() method needs to be modified to extract the location from the intent and use it to return the matching timeline.
Edit the WeatherWidget.swift file, locate the getTimeline() method within the provider declaration and modify it so that it reads as follows:
func getTimeline(for configuration: ConfigurationIntent, in context: Context,
completion: @escaping (Timeline<Entry>) -> ()) {
var chosenLocation: LocationData...