Meet WeatherKit

RSS for tag

Discuss the WWDC22 Session Meet WeatherKit

Posts under wwdc2022-10003 tag

4 Posts
Sort by:
Post not yet marked as solved
3 Replies
1.4k Views
I'm trying to get historical data using the following syntax: try await service.weather(for: location, including: .daily(startDate: past1, endDate: past2)) Where past1 and past2 are two dates in the past (I checked their format and they are correct). I always get the same result, namely the 10 days default forecast you usually get calling service.weather(for: location) Am I missing something?
Posted
by Jklr.
Last updated
.
Post marked as solved
2 Replies
1.5k Views
I am able to obtain daily forecasts via the REST API which include the daytimeForecast and overnightForecast records with their respective properties like cloudCover. So far I have failed to access them via the Swift API: forecast.daytimeForecast.cloudCover results in: "Value of type 'DayWeather' has no member 'daytimeForecast'". But if I print() the DayWeather objects, these members are actually printed with all their properties. Is there a way to get them I am overlooking?
Posted
by RK123.
Last updated
.
Post not yet marked as solved
2 Replies
1.1k Views
Hi, I'm in the process of developing a weather app using WeatherKit. Everything seems to be working fine in the Simulator, but when I put it on the device (iPhone 13 Pro Max) the temperature displays wrong. Example: On Simulator: 34 F On Device: 34.98 F Anyone else have this problem? Dan Uff
Posted Last updated
.
Post marked as solved
1 Replies
600 Views
'async' call cannot occur in a global variable initializer for weather variable. import WeatherKit import CoreLocation let weatherService = WeatherService() let chicago = CLLocation(latitude: 47, longitude: 87.58293) let weather = try! await weatherService.weather(for: chicago) let temperature = weather.currentWeather.temperature
Posted
by Davu.
Last updated
.