Contents

weather(for:including:)

Returns the weather forecast for the requested location.

Declaration

@preconcurrency final func weather<T>(for location: CLLocation, including dataSet: WeatherQuery<T>) async throws -> T where T : Sendable

Parameters

  • location:

    The requested location.

Return Value

The requested weather data set.

Discussion

This is a variadic API in which any combination of data sets can be requested and returned as a tuple. Here’s an example:

let current = try await service.weather(for: newYork, including: .current)