WeatherKit with AI agents
Use WeatherKit to deliver current conditions, minute precipitation, hourly and daily forecasts, and severe weather alerts. Enable the WeatherKit capability in Xcode. Call WeatherService.weather(for:) with a CLLocation, then show the required attribution — the legal page and the Apple Weather mark. Look up Apple's WeatherKit docs first.
Last updated:
Apple facts are from "WeatherKit", "WeatherService", "weather(for:)", "Weather", "WeatherAttribution", "attribution", "legalPageURL", "legalAttributionText", "WeatherAvailability" and "WeatherKit Entitlement" on developer.apple.com. Tool facts are from each README. Stars as of 18 Nov 2026.
What Apple documents
WeatherKit delivers weather conditions and alerts to your users. Apple’s overview says it provides timely weather information including current conditions, minute precipitation, hourly and daily forecasts, and severe weather alerts. It is documented for iOS 16, iPadOS 16, Mac Catalyst 16, macOS 13, tvOS 16, visionOS 1 and watchOS 9. Follow WeatherKit.
Enable the WeatherKit capability in Xcode so the app may use the framework. The WeatherKit Entitlement (
com.apple.developer.weatherkit) is a Boolean value that indicates whether the app may use WeatherKit. Apple’s discussion says: to add this entitlement to your app, enable the WeatherKit capability in Xcode.WeatherServiceprovides an interface for obtaining weather data.weather(for:)returns the weather forecast for the requested location:weather(for location: CLLocation) async throws -> Weather. Thelocationparameter is the requested location; the return value is the aggregate weather; the method throws aWeatherError.WeatherService.sharedis a single, shared weather service object. How you obtain thatCLLocation, and the Core Location permission that goes with it, stay in Core Location permissions with AI agents.Weatheris a model representing the aggregate weather data the caller requests. It exposescurrentWeather,dailyForecast,hourlyForecast, optionalminuteForecast, optionalweatherAlerts, andavailability.WeatherAvailabilityindicates the availability of data at the requested location. Apple says weather alerts or minute forecast data may be temporarily unavailable from the data provider, or unsupported in some regions. Other data sets, for example current weather, are expected to be supported for all geographic locations and are therefore not included inWeatherAvailability.Attribution is required.
WeatherService.attributionis “the required attribution which includes a legal attribution page and Apple Weather mark” (var attribution: WeatherAttribution { get async throws }).WeatherAttribution“defines the necessary information for attributing a weather data provider.” Its overview states: “Attribution is required for publishing software using WeatherKit.”legalPageURLis a link to the legal attribution page that contains copyright information about the weather data sources. The structure also provides combined Apple Weather marks (combinedMarkDarkURL,combinedMarkLightURL), asquareMarkURL, andserviceName.legalAttributionText(from iOS 16.4) “returns text that should be made available to users for apps that cannot display the attributionURL contents in a Safari view. It contains language that outlines the weather data sources attribution and is a legal requirement of using WeatherKit.”
Rules for AGENTS.md
Code
- Use WeatherKit for current conditions, minute precipitation, hourly and daily forecasts, and severe weather alerts. Enable the WeatherKit capability in Xcode (com.apple.developer.weatherkit).
- Request forecasts with WeatherService.weather(for:) and a CLLocation. Do not invent a REST or JWT WeatherKit flow for a native Swift app. Core Location authorization stays in the Core Location rules, not here.
- Attribution is required for publishing software using WeatherKit. Show WeatherService.attribution: the legal page (legalPageURL) and the Apple Weather mark. For apps that cannot display the attribution URL in a Safari view, make legalAttributionText available to users.
- Treat missing weatherAlerts or minuteForecast as possibly unavailable or unsupported in that region (WeatherAvailability). Look up Apple's WeatherKit docs first.Step 1: ground the agent in Apple's WeatherKit docs
Install Apple Docs MCP or Sosumi and ask it to open “WeatherKit”, WeatherService, weather(for:), WeatherAttribution and the WeatherKit entitlement. Confirm the work is the Swift WeatherKit framework, not a third-party weather API and not Core Location permission setup.
Step 2: enable the WeatherKit capability
Have the agent enable the WeatherKit capability in Xcode so com.apple.developer.weatherkit is present. Do not let it skip the entitlement and call WeatherService anyway.
Step 3: request weather, then show attribution
Call WeatherService.weather(for:) with a CLLocation and read Weather (currentWeather, forecasts, optional alerts). Check WeatherAvailability before assuming alerts or a minute forecast exist. Load WeatherService.attribution and show the legal page and Apple Weather mark; if the app cannot display the attribution URL in a Safari view, make legalAttributionText available.
Step 4: review the SwiftUI around the weather UI
Run swiftui-pro on the screens that show conditions, forecasts, alerts or attribution marks. Do not restyle the Apple Weather mark or hide the legal attribution.
Tools compared (4)
| Tool | Best for | Agents (README) | Install (README) | License | Stars | Last push |
|---|---|---|---|---|---|---|
| Apple Docs MCP (kimsungwhee) | Look up WeatherKit APIs, the entitlement and attribution | Claude Code, Cursor, VS Code, Windsurf | claude mcp add apple-docs -- npx -y @kimsungwhee/apple-docs-mcp@latest | MIT | 1388 | 17 Mar 2026 ⚠ |
| sosumi.ai (NSHipster) | Pull WeatherKit and entitlement docs as Markdown | any MCP host | npx -y mcp-remote https://sosumi.ai/mcp | MIT | 492 | 13 Nov 2026 |
| ApKI (Gucky) | Route the agent to official Apple developer resources | Codex, Claude Code | npx skills add https://github.com/Gucky/ApKI --skill apki | MIT | 2 | 3 Nov 2026 |
| swiftui-pro (twostraws) | Modern SwiftUI around conditions, forecasts and attribution | Claude Code, Cursor, Codex, Gemini | npx skills add https://github.com/twostraws/SwiftUI-Agent-Skill --skill swiftui-pro | MIT | 6582 | 26 Oct 2026 |
⚠ = no push in the last 4 weeks.
Which one to pick
Official API lookup → Apple Docs MCP or Sosumi.
A short route into Apple's current developer resources → ApKI.
SwiftUI around the weather UI → swiftui-pro.
A prompt that keeps the agent honest
Code
Add WeatherKit to this iOS app. Enable the WeatherKit capability in Xcode (com.apple.developer.weatherkit). Use WeatherService.weather(for:) with a CLLocation to load current conditions, hourly and daily forecasts, and, when WeatherAvailability says they are available, minute precipitation and severe weather alerts. Show the required attribution from WeatherService.attribution: the legal page (legalPageURL) and the Apple Weather mark. If the app cannot display the attribution URL in a Safari view, make legalAttributionText available to users. Do not invent a REST WeatherKit client or skip attribution. Leave Core Location authorization to our existing location flow. Look up “WeatherKit”, WeatherService, weather(for:), WeatherAttribution and “WeatherKit Entitlement” in Apple's docs first.FAQ
- Do I need a WeatherKit entitlement?
- Yes. The WeatherKit Entitlement (`com.apple.developer.weatherkit`) is a Boolean value that indicates whether the app may use WeatherKit. Apple’s discussion says: to add this entitlement to your app, enable the WeatherKit capability in Xcode.
- How do I request a forecast?
- Use `WeatherService`. `weather(for:)` returns the weather forecast for the requested location: `weather(for location: CLLocation) async throws -> Weather`. The return value is the aggregate weather (`currentWeather`, daily, hourly, optional minute forecast and optional alerts) and the method throws a `WeatherError`. `WeatherService.shared` is a single, shared weather service object. Obtaining the `CLLocation` and asking for location permission stay in the Core Location guide.
- Is attribution required?
- Yes. Apple’s `WeatherAttribution` overview says attribution is required for publishing software using WeatherKit. `WeatherService.attribution` is the required attribution, which includes a legal attribution page and the Apple Weather mark. `legalPageURL` links to the legal attribution page with copyright information about the weather data sources. For apps that cannot display the attribution URL in a Safari view, `legalAttributionText` (from iOS 16.4) is text that should be made available to users and is a legal requirement of using WeatherKit.
- What if alerts or the minute forecast are missing?
- `WeatherAvailability` indicates the availability of data at the requested location. Apple says weather alerts or minute forecast data may be temporarily unavailable from the data provider, or unsupported in some regions. Other data sets, for example current weather, are expected to be supported for all geographic locations and are therefore not included in `WeatherAvailability`.
- Which tools should the agent use first?
- Apple Docs MCP or Sosumi, so the agent opens “WeatherKit”, `WeatherService`, `weather(for:)`, `WeatherAttribution` and the WeatherKit entitlement instead of calling a third-party weather API or skipping attribution. Add swiftui-pro for the SwiftUI around the weather UI.