AirQualityService
Fetches air quality data from the Open-Meteo Air Quality API.Singleton instance for app-wide access
fetchAirQuality
Retrieves current air quality data for specific coordinates.BreezeApp/Services/AirQualityService.swift
Double
required
Latitude coordinate (-90 to 90)
Double
required
Longitude coordinate (-180 to 180)
AirQuality
Complete air quality data including AQI and all pollutant concentrations
fetchMultipleCities
Fetches AQI values for multiple cities simultaneously (used for ticker display).BreezeApp/Services/AirQualityService.swift
[TopCity]
required
Array of cities to fetch AQI data for
[(city: TopCity, aqi: Int?)]
Array of tuples containing city and optional AQI value
GeocodingService
Searches for cities using the Open-Meteo Geocoding API.BreezeApp/Services/GeocodingService.swift
searchCities
Searches for cities matching a query string.String
required
Search term (minimum 2 characters)
[City]
Up to 5 matching cities with coordinates and location details
The service returns an empty array if the query is less than 2 characters to avoid unnecessary API calls.
PollenService
Fetches pollen data through a backend proxy that communicates with the Google Pollen API.BreezeApp/Services/PollenService.swift
fetchPollen
Retrieves pollen data for specific coordinates via backend proxy.Double
required
Latitude coordinate
Double
required
Longitude coordinate
[PollenItem]
Array of pollen items including general types (Grass, Tree, Weed) and specific plants (Oak, Birch, etc.)
ClimateService
Fetches historical temperature data from the Open-Meteo Historical Weather API.BreezeApp/Services/ClimateService.swift
fetchClimateData
Retrieves historical maximum temperature data for today’s date across multiple decades.Double
required
Latitude coordinate
Double
required
Longitude coordinate
[ClimateDataPoint]
Array of temperature data points for years 1980, 1990, 2000, 2010, 2020, and current year
This method fetches data for the current day of the year across multiple decades to visualize climate change trends. Each year’s data is fetched in parallel for better performance.
Error Handling
All services use Swift’s native error handling withasync throws:
URLError.badURL- Invalid URL constructionURLError.badServerResponse- Non-200 HTTP status codeDecodingError- JSON parsing failure- Custom
NSError- Service-specific errors (e.g., no data available)
Thread Safety
All services are implemented as Swiftactor types, ensuring:
- Thread-safe access to shared state
- No data races
- Automatic synchronization across concurrent calls