← ClaudeAtlas

weatherkitlisted

Fetch current, hourly, and daily weather forecasts and display required attribution using WeatherKit. Use when integrating weather data, showing forecasts, handling weather alerts, displaying Apple Weather attribution, or querying historical weather statistics in iOS apps.
dpearson2699/swift-ios-skills · ★ 730 · AI & Automation · score 80
Install: claude install-skill dpearson2699/swift-ios-skills
# WeatherKit Fetch current conditions, hourly and daily forecasts, weather alerts, and historical statistics using `WeatherService`. Display required Apple Weather attribution. Targets Swift 6.3 / iOS 26+. ## Contents - [Setup](#setup) - [Fetching Current Weather](#fetching-current-weather) - [Forecasts](#forecasts) - [Weather Alerts](#weather-alerts) - [Selective Queries](#selective-queries) - [Attribution](#attribution) - [Availability](#availability) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) - [References](#references) ## Setup ### Project Configuration 1. Enable the **WeatherKit** capability in Xcode (adds the entitlement) 2. Enable WeatherKit for your App ID in the Apple Developer portal 3. Add `NSLocationWhenInUseUsageDescription` to Info.plist if using device location 4. WeatherKit requires an active Apple Developer Program membership ### Import ```swift import WeatherKit import CoreLocation ``` ### Creating the Service Use the shared singleton or create an instance. The service is `Sendable` and thread-safe. ```swift let weatherService = WeatherService.shared // or let weatherService = WeatherService() ``` ## Fetching Current Weather Fetch current conditions for a location. Returns a `Weather` object with all available datasets. ```swift func fetchCurrentWeather(for location: CLLocation) async throws -> CurrentWeather { let weather = try await weatherService.weather(for: location) return weather.currentWeather