Overnightforecast data from weatherResponse.dailyForecast.forecast array object

Background: We are using Apple WeatherKit for an app to fetch future weather data specialty cloudCover and condition and pretipitationChance from the Overnightforecast data from weatherResponse.dailyForecast.forecast array object.

Code Sample: On xcode on Swift and Swift UI using Apple WeatherKit

task{ do{ let weatherResponse= try await self.weatherService.forecast(for: latLong) let cloudCover = weatherResponse.dailyForecast.forecast[0].overnightforecast.cloudCover

Issue: While we are on debug mode, we can literally see overnightforecast.cloudCover data (as well as condition and pretipitationChance) is available under from index 0 to index 10 of weatherResponse.dailyForecast.forecast array object but when we are trying to assign this property, its throwing error as

"overnightforecast object not present under weatherResponse.dailyForecast.forecast array object"

Attachment:

Hi BortleBuddy, overnightForecast was added in iOS 18. What version of Xcode are you using and what device and OS version are you trying to build for?

Thank you for your answer. Here is my dev team shared about the versions: Xcode: 15.1 iOS: 17.2

PS: I am from MS C# background and it's so disappointing to see Apple doesn't maintain backward compatibility. Now the app will be of no use if we don't have Overnightforecast from apple's Weatherkit but look for other alternative and move quickly to Android :)

Overnightforecast data from weatherResponse.dailyForecast.forecast array object
 
 
Q