Skip to content
This repository was archived by the owner on Aug 6, 2024. It is now read-only.

Repository files navigation

Usage

Supported Weather APIs:

Dark Sky

A default Request.send function is provided that simply uses the shared URLSession in your app:

import Jupiter
letapi=DarkSkyAPI(key:"<API_KEY>")
api.forecast(latitude:47.6062, longitude:-122.3321).send{ result ->Voidinswitch result {case.success(let response):
// The response here is queryable for any key available in the docs except for "flags"
print(response)case.error(let error):print(error)}}

However if you'd like to use your own networking stack, you can simply create a DarkSkyForecastRequest and use the generated URL directly:

import Jupiter
letapi=DarkSkyAPI(key:"<API_KEY>")letrequest= api.forecast(latitude:47.6062, longitude:-122.3321)
/// Creating without the convenience API also works:
/// let request = DarkSkyForecastRequest(key: "<API_KEY>", latitude: 47.6062, longitude: -122.3321)
/// Configure the request
request.excludes =[.minutely,.hourly]
request.lang =.russian
request.units =.si
/// Get the URL
leturl:URL= request.url!
/// Pass URL to networking layer /// Get raw data from networking layer
letdata:Data=...
/// Parse data and bind to response object
letresponse=DarkSkyForecastRequest.toResponse(data: data)

Climacons

Jupiter has first-class support for Climacons, a beautiful set of pictographs designed by Adam Whitcroft. All icon-related fields on response models will be bound to the Climacon enum defined in Jupiter, whose raw values map directly to the Climacons-Font bundled by Christian Naths.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build Jupiter 0.0.1+.

To integrate Jupiter into your Xcode project using CocoaPods, specify it in your Podfile:

source'https://github.com/CocoaPods/Specs.git'platform:ios,'10.0'use_frameworks!pod'Jupiter','~> 0.0.2'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Jupiter into your Xcode project using Carthage, specify it in your Cartfile:

github "comyar/Jupiter" ~> 0.0.2

License

Jupiter is released under the MIT license. See LICENSE for details.

About

🌞 The Swift Weather Framework

Resources

Stars

14 stars

Watchers

1 watching

Forks

Contributors

Languages