weatherkit-doomfish 0.2.0

Safe Rust bindings for Apple's WeatherKit framework — weather data on macOS
Documentation

weatherkit-rs

Safe Rust bindings for Apple's WeatherKit framework on macOS 13+.

The published package is weatherkit-doomfish; the Rust library crate is imported as weatherkit.

Status: v0.2.0 covers WeatherService, CurrentWeather, daily/hourly/minute forecasts, weather alerts, availability metadata, WeatherAttribution, SunEvents, MoonEvents, WeatherCondition descriptors, and Pressure helpers.

Quick start

use weatherkit::prelude::*;

fn main() -> Result<(), WeatherKitError> {
    let service = WeatherService::shared();
    let location = CLLocation::new(37.3349, -122.0090);
    let current = service.current_weather(&location)?;

    println!(
        "current temperature: {:.1}°C ({:?})",
        current.temperature,
        current.condition
    );
    Ok(())
}

Highlights

  • WeatherService::weather, current_weather, daily_forecast, hourly_forecast, minute_forecast, weather_alerts, availability, and attribution
  • DailyForecast / HourlyForecast containers with WeatherKit metadata plus DayForecast / HourForecast entries
  • CurrentWeather with precipitation intensity, metadata, and cloud-cover-by-altitude when available on macOS 15+
  • DayForecast with SunEvents, MoonEvents, UVIndex, wind, day-part forecasts, and precipitation-by-type details when available
  • WeatherAttribution, WeatherSeverity, AvailabilityKind, WeatherCondition, PressureTrend, and MoonPhase descriptor catalogs
  • Async Swift APIs bridged to synchronous Rust via DispatchSemaphore + Task, with opaque handle ownership released on the Rust side

Entitlements / caveats

WeatherKit usually requires an entitled bundle ID backed by a paid Apple Developer membership. Unsigned CLI binaries often fail with permission or bundle-configuration errors; every example in examples/ treats that as a caveat instead of a hard failure.

Examples

Each logical area has a dedicated example:

cargo run --example 01_weather_service_smoke
cargo run --example 02_current_weather_snapshot
cargo run --example 03_daily_forecast_snapshot
cargo run --example 04_hourly_forecast_snapshot
cargo run --example 05_weather_alerts_snapshot
cargo run --example 06_minute_forecast_snapshot
cargo run --example 07_availability_kind_catalog
cargo run --example 08_weather_attribution_snapshot
cargo run --example 09_sun_events_snapshot
cargo run --example 10_moon_events_snapshot
cargo run --example 11_weather_condition_catalog
cargo run --example 12_pressure_catalog

License

Licensed under either Apache-2.0 or MIT at your option.