A pure Swift SDK for consuming the official StormGlass API
Currently only the Global & Marine Weather APIs are supported.
StormGlassKit is available through Swift Package Manager, a dependency manager built into Xcode.
If you are using Xcode 11 or higher, go to File / Swift Packages / Add Package Dependency... and enter package repository URL https://github.com/StarLard/StormGlassKit.git, then follow the instructions.
To remove the dependency, select the project and open Swift Packages (which is next to Build Settings). You can add and remove packages from this tab.
Swift Package Manager can also be used from the command line.
- In your UIKit application's
application(_:didFinishLaunchingWithOptions:)method or SwiftUIAppinitializer, configureStormGlassKitusing one of the following methods:- Add a
StormGlassKit-Configuration.plistfile to your project that includes an "API_KEY" key with your API key as the value. You may then callStormGlassKit.configure(). - Create and configure a custom
StormGlassKit.Configurationand use it to callStormGlassKit.configure(with:).
- Add a
- Get weather forcasts using the
StormGlassKit.fetchWeather(...)method. StormGlassKit is consumable through Swift Concurrency's async/await pattern. The returned value will contain aWeathertype which contains the requested forecast, organized by hour, and the associated meta data.
StormGlassKit is available under the Apache 2.0 license. See the LICENSE file for more info.