openweathermap-swift-sdk 0.1.0

openweathermap-swift-sdk 0.1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Ulaş Sancak.



 
Depends on:
Alamofire~> 4.4
ObjectMapper~> 2.2
 

  • By
  • Ulaş Sancak

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

openweathermap-swift-sdk is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "openweathermap-swift-sdk"

Usage

API Key
import openweathermap_swift_sdk

OpenWeatherMapClient.client(appID: "app_id")
Getting Current Conditions
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getWeather(cityName: "istanbul") { (weatherData, error) in
    if error == nil && weatherData!.code == "200" {
        //Data received
    }
}
Getting Current Conditions for Several Cities
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getWeather(cityIDs: [524901, 703448, 2643743], limit: 0) { (result, error) in
    if error == nil && result!.code == "200" {
        //Data received
    }
}
Getting Hourly Forecast
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getForecast(cityName: "istanbul", countryCode: "tr", limit: 0) { (result, error) in
    if error == nil && result!.code == "200" {
        //Data received
    }
}
Getting Daily Forecast
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getDailyForecast(cityName: "istanbul", countryCode: "tr", limit: 0) { (result, error) in
    if error == nil && result!.code == "200" {
        //Data received
    }
}

Author

Ulaş Sancak, [email protected]

License

openweathermap-swift-sdk is available under the MIT license. See the LICENSE file for more info.