Giter VIP home page Giter VIP logo

jupiter's Introduction

Usage

Supported Weather APIs:

Dark Sky

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

import Jupiter

let api = DarkSkyAPI(key: "<API_KEY>")
api.forecast(latitude: 47.6062, longitude: -122.3321).send { result -> Void in
  switch 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

let api = DarkSkyAPI(key: "<API_KEY>")
let request = 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
let url: URL = request.url!

/// Pass URL to networking layer 

/// Get raw data from networking layer
let data: Data = ...

/// Parse data and bind to response object
let response = 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.

jupiter's People

Contributors

comyar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

humidbrains

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.