openweathermap-swift-sdk 0.1.0

openweathermap-swift-sdk 0.1.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2017年4月
SwiftSwift 版本3.0
SPM支持 SPM

Ulaş Sancak 维护。



 
依赖关系
Alamofire~> 4.4
ObjectMapper~> 2.2
 

  • Ulaş Sancak

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

需求

安装

openweathermap-swift-sdk 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod "openweathermap-swift-sdk"

用法

API 密钥
import openweathermap_swift_sdk

OpenWeatherMapClient.client(appID: "app_id")
获取当前条件
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getWeather(cityName: "istanbul") { (weatherData, error) in
    if error == nil && weatherData!.code == "200" {
        //Data received
    }
}
获取多个城市的当前条件
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getWeather(cityIDs: [524901, 703448, 2643743], limit: 0) { (result, error) in
    if error == nil && result!.code == "200" {
        //Data received
    }
}
获取小时预报
import openweathermap_swift_sdk

OpenWeatherMapAPIClient.client.getForecast(cityName: "istanbul", countryCode: "tr", limit: 0) { (result, error) in
    if error == nil && result!.code == "200" {
        //Data received
    }
}
获取每日预报
import openweathermap_swift_sdk

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

作者

Ulaş Sancak, [email protected]

许可证

openweathermap-swift-sdk 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。