Skip to content

A simple Swift library for accessing weather data in your app.

License

Notifications You must be signed in to change notification settings

davemess/WeatherKit

Repository files navigation

Swift Build Status Carthage compatible License Platform

WeatherKit

A simple Swift library for accessing weather data in your app. WeatherKit is based on the OpenWeatherMap API.

Features include getting location-based current weather conditions based on:

  • City name
  • City ID Code
  • Lat/lon coordinates
  • Zip code

Installation

Recommended to use Carthage.

  • Add github.com/davemess/WeatherKit.git to your Cartfile
  • Perform a carthage update
  • Embed the built product in your app's embedded frameworks.

Usage

  1. Initialize your WeatherKit instance:

let weatherKit = WeatherKit(apiKey: <#API_KEY#>)

  1. Request weather at a location:
let coordinate: CLLocationCoordinate2D = // access the user's current location
weatherKit.getCurrentWeather(at: coordinate, success: { (weather) in
      // do something with `weather`
    }) { (error) in
      // handle error
    }
  1. Use properties of the Weather struct, including temperature, humidity, rainfail, etc.

TODO

Admin

  • Document public interface
  • Update readme with usage
  • Versioning

Project

  • Unit Testing
  • Swift Lint
  • Docs
  • Badges

Features

  • Add Current Weather
  • Check HTTP status code
  • Add Forecast
  • Configure timeout/urlsession
  • Add Operations/Operation Queue
  • Update for Xcode 10