A swift package that enables swifty communication with the free Open-Meteo API. Please note that this package is still under development and may have several bugs.
Please refer to the full documentation that has additional guides and other supporting documentation.
Current Features
- Weather Forecast Calls
- Marine Forecast Calls
- Geocoding API Calls
Todo:
- Clean up return data for marine forecast
- Add historical forecast
- Add air quality forecast
- Maybe more? Submit an issue for requests :)
See the full API explorer on the official Open-Meteo website
An example forecast request could look like the following:
let result = await OpenMeteo().forecast(
lat: 34.03,
long: -118.49,
hourly: [
.temperature2m,
.apparentTemperature,
],
currentWeather: true,
timezone: "America/Los_Angeles",
pastDays: 2,
forecastDays: 5,
temperatureUnit: .fahrenheit,
windSpeedUnit: .mph,
precipitationUnit: .inch
)
if let error = result.error {
// Handle Error
} else if let data = result.data {
// Handle Data
}