适用于 Swift 的风暴瓶 (Storm Glass)

直接从世界上最受信任的气象机构获取全球高分辨率天气预报。

要使用此软件包,您首先需要从 Storm Glass 获取 API 密钥。

安装

使用 Swift Package Manager 将软件包添加到您的 Xcode 项目。

用法

// Step 1:
// Configure API Key

SGConfiguration.shared.apiKey = "your-api-key"

// Step 2:
// Create Endpoint Request

import StormGlass
let endpoint = SGWeatherPointRequest(... parameters)

// Step 3:
// Create Networking Request

let request = SGRequest(endpoint: endpoint)

// Step 4:
// Execute

request.fetch { result in
    // Step 5:
    // Handle Result...
    
    // (psst, this is where you put your code using the data!)
}