Skip to main content
net10.0-ios26.2net10.0-maccatalyst26.2net10.0-macos26.2net10.0-tvos26.2

Native Swift interop bindings for Apple WeatherKit

Published
Sep 5, 2026
1mo ago
Total Downloads
1.6K
1,568

Install

dotnet add package SwiftBindings.Apple.WeatherKit --version 26.2.14
ProductVersions
.NET
net10.0-ios26.2net10.0-maccatalyst26.2net10.0-macos26.2net10.0-tvos26.2

README

SwiftBindings.Apple.WeatherKit

Native .NET bindings for Apple's WeatherKit framework β€” current conditions, hourly and daily forecasts, severe-weather alerts, and historical data. These are not Objective-C proxy wrappers; they use .NET 10's native Swift interop for direct, high-performance calls into Swift APIs from C#.

πŸ“– Full usage guide β†’ β€” the complete fetch path (WeatherService β†’ Weather β†’ current/hourly/daily forecasts), reading Measurement<T> values, conditions/precipitation/wind/UV/moon enums, alerts, attribution, and the APIs that aren't bound yet.

Installation

dotnet add package SwiftBindings.Apple.WeatherKit

Requirements

  • .NET 10.0+
  • Target framework: net10.0-ios26.2 (or -macos26.2 / -maccatalyst26.2 / -tvos26.2) or higher. The package is compiled against the iOS 26.2 SDK supplement, so your app's <TargetFramework> platform version must be β‰₯ 26.2 to restore it β€” an explicit lower TPV (e.g. net10.0-ios18.0) or a bare net10.0-ios whose installed workload defaults below 26.2 fails restore with NU1202. This is the compile-SDK pin, not your app's deployment minimum.
  • Deployment minimum is separate β€” set your app's real minimum OS with <SupportedOSPlatformVersion> (independent of the TFM above). Individual APIs that need a newer OS at runtime are gated by generated [SupportedOSPlatform] attributes; the C# compiler flags a call that isn't valid for your target.
  • macOS host for development
  • WeatherKit capability enabled and a paid Apple Developer Program membership (WeatherKit usage is metered and requires entitlement)

Usage

using WeatherKit;

var service = WeatherService.Shared;

// Get current attribution (logo + URL link required by Apple's terms)
var attribution = await service.GetAttributionAsync();

// Localised condition / phase descriptions
var phase = MoonPhase.Full.GetDescription();
var direction = Wind.CompassDirectionKind.North.GetDescription();

Iterating a forecast

Forecast<T> projects to IReadOnlyList<T>, so the standard C# enumeration shape just works:

// `weather` is an instance returned by WeatherService.GetWeatherAsync(...)
foreach (var hour in weather.HourlyForecast)
{
    Console.WriteLine($"{hour.Date}: {hour.Temperature}");
}

var firstDay = weather.DailyForecast[0];
var dayCount = weather.DailyForecast.Count;

Documentation

How It Works

These bindings are auto-generated by Swift Dotnet Bindings using .NET 10's native Swift interop via the SwiftBindings SDK.

License

The bindings are MIT licensed. WeatherKit is part of the Apple SDK; refer to Apple's licensing for the underlying framework.

Changes from Previous Version

No structural changes between v26.2.13 and v26.2.14.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.