App developers face various challenges when they want to obtain and process weather data for their apps. Weather services provide APIs for retrieving the weather data, but the data offer differs in terms of timeliness, accuracy, restrictions such as national borders and costs. Some of these services are free. They often have a so-called rate limit, which limits the number of accesses to their API for a certain period of time. Others exclude some of the possible data from their free offer, such as historical values or weather forecasts. The obligation to pay and the reliability of the data are not necessarily related.
The providers include authorities such as the German Weather Service or the US National Weather Service as well as specialized weather companies such as wetter.com GmbH, Openweather Ltd. or dark sky. Apple acquired the latter in April 2020 and discontinued Dark Sky as a standalone service on March 31, 2023. This resulted in the new Apple Weather Service with two different interfaces: WeatherKit and the WeatherKit REST API. The latter is independent of programming language and platform, you can also address it from Android, Windows or a web app. Information on the WeatherKit REST API can be found at Apple.
- WeatherKit and the WeatherKit REST API are available to Apple developers free of charge for up to 500,000 calls per month.
- WeatherKit provides accurate and up-to-date weather information for locations around the world, including Germany.
- Detailed information includes humidity, probability of precipitation and UV index.
- With Swift Charts, different diagrams for visualizing facts can be created quickly and easily.
If you are developing for the Apple platform or are retrieving and possibly preprocessing the data from your own server, retrieve the data directly from WeatherKit. In this article you will learn how to integrate Apple’s weather service with just a few lines of code and how to display the data in an appealing way with Swift Charts or new Swift features such as async/await.