Skip to content

V2#42

Merged
jagreenwood merged 12 commits into
mainfrom
v2
Nov 5, 2025
Merged

V2#42
jagreenwood merged 12 commits into
mainfrom
v2

Conversation

@jagreenwood

@jagreenwood jagreenwood commented Oct 30, 2025

Copy link
Copy Markdown
Owner

This major release brings OpenWeatherKit up to date with the latest WeatherKit REST API capabilities, adds Swift 6 support, and introduces powerful new features for historical weather data analysis.

Major Features

Weather Statistics API

Access climatological statistics derived from decades of historical weather data:

  • Daily Statistics - Get historical temperature and precipitation patterns for any day of the year (1-366)
  • Hourly Statistics - Access hour-by-hour historical averages throughout the year (1-8784)
  • Monthly Statistics - Retrieve monthly climatological data for all 12 months
  • Percentile Distributions - P10, P50, and P90 values for probability analysis

All statistics methods support flexible date ranges with sensible defaults and variadic parameter packs for type-safe multi-dataset queries.

Daily Weather Summaries

Retrieve actual aggregated weather data for past dates:

  • Historical precipitation and temperature summaries
  • Flexible date range queries (day-of-year, date intervals, or default 30-day lookback)
  • Perfect for analyzing recent weather trends

Weather Changes & Historical Comparisons

  • Weather Changes - Get forecasted changes in temperature and precipitation relative to previous periods
  • Historical Comparisons - Compare current conditions against long-term averages with deviation analysis (much higher, higher, normal, lower, much lower)

Swift 6 Support

  • Full Swift 6 language mode compatibility
  • Complete Sendable conformance across all public types
  • Modern concurrency patterns with variadic parameter packs
  • Backward compatible with Swift 5.9+

Technical Improvements

Enhanced Type Safety

  • Variadic generic methods for weather queries, statistics, and summaries
  • Type-safe query builders prevent invalid API requests at compile time
  • Improved error handling with descriptive error messages

Developer Experience

  • Example App - Comprehensive iOS example app demonstrating all API features
  • Enhanced Documentation - Complete DocC documentation coverage for all new types and methods
  • SwiftLint Integration - Claude Code hook for automatic linting on file edits

Platform Support

  • New explicit countryCode and timezone parameters for Linux compatibility
  • Automatic geocoding on Apple platforms via CoreLocation
  • Consistent API across all supported platforms

New Public Types

Statistics:

  • DailyWeatherStatistics<T>, HourlyWeatherStatistics<T>, MonthlyWeatherStatistics<T>
  • DayPrecipitationStatistics, DayTemperatureStatistics
  • HourTemperatureStatistics
  • MonthPrecipitationStatistics, MonthTemperatureStatistics
  • Percentiles<Dimension>

Summaries:

  • DailyWeatherSummary<T>
  • DayPrecipitationSummary, DayTemperatureSummary

Forecast Enhancements:

  • WeatherChanges / WeatherChange
  • HistoricalComparisons / HistoricalComparison
  • Trend<Dimension>, TrendBaseline<Dimension>, Deviation

Query Types:

  • DailyWeatherStatisticsQuery<T>
  • HourlyWeatherStatisticsQuery<T>
  • MonthlyWeatherStatisticsQuery<T>
  • DailyWeatherSummaryQuery<T>

Additional Characteristics:

  • CloudCoverByAltitude
  • DayPartForecast
  • PrecipitationAmountByType
  • SnowfallAmount

API Changes

New WeatherService Methods

Statistics:

func dailyStatistics(for:including:) -> (repeat DailyWeatherStatistics<each T>)
func dailyStatistics(for:startDay:endDay:including:) -> (repeat DailyWeatherStatistics<each T>)
func dailyStatistics(for:forDaysIn:including:) -> (repeat DailyWeatherStatistics<each T>)

func hourlyStatistics(for:including:) -> (repeat HourlyWeatherStatistics<each T>)
func hourlyStatistics(for:startHour:endHour:including:) -> (repeat HourlyWeatherStatistics<each T>)
func hourlyStatistics(for:forHoursIn:including:) -> (repeat HourlyWeatherStatistics<each T>)

func monthlyStatistics(for:including:) -> (repeat MonthlyWeatherStatistics<each T>)
func monthlyStatistics(for:startMonth:endMonth:including:) -> (repeat MonthlyWeatherStatistics<each T>)
func monthlyStatistics(for:forMonthsIn:including:) -> (repeat MonthlyWeatherStatistics<each T>)

Summaries:

func dailySummary(for:including:) -> (repeat DailyWeatherSummary<each T>)
func dailySummary(for:startDay:endDay:including:) -> (repeat DailyWeatherSummary<each T>)
func dailySummary(for:forDaysIn:including:) -> (repeat DailyWeatherSummary<each T>)

New Query Options:

WeatherQuery.changes
WeatherQuery.historicalComparisons

Documentation Updates

  • Comprehensive DocC documentation for all new types and methods
  • Updated README with usage examples for all new features
  • Enhanced Getting Started guide
  • Complete API reference coverage

Testing

  • Added comprehensive test coverage for statistics and summaries
  • Mock client support for all new API endpoints
  • Platform-specific test cases for Apple and Linux

commit 70770bb4b1e395ff49edc35d62847adb1c2208f7
Author: Jeremy Greenwood <jagreenwood@gmail.com>
Date:   Thu Oct 23 14:56:09 2025 -0400

    swiftlint

commit 3d16c1688c43cd3e1423c69ed816fe47df5b8a13
Author: Jeremy Greenwood <jagreenwood@gmail.com>
Date:   Thu Oct 23 14:55:59 2025 -0400

    update container tools

commit f44a797
Author: Jeremy Greenwood <jagreenwood@gmail.com>
Date:   Thu Feb 20 11:26:03 2025 -0500

    Enable Swift 6 Mode (#38)
@jagreenwood jagreenwood marked this pull request as ready for review November 5, 2025 21:21
@jagreenwood jagreenwood merged commit f1eb1a2 into main Nov 5, 2025
4 checks passed
@jagreenwood jagreenwood deleted the v2 branch November 5, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant