Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 1.65 KB

README.md

File metadata and controls

49 lines (40 loc) · 1.65 KB

OpenMeteo Swift

Swift Test Badge Deploy DocC

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 & Todo:

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
}