Contents

bmonty/AvWeather

Swift package to process data from aviationweather.gov.

Sigmets

AWC distinguishes between international and US Sigmets. Both can be retrieved by AvWeather, and represented by one common Sigmet class, although with some different properties. Refer to the implementation in Sigmet.swift for details.

import AvWeather

let weatherClient = AWCClient()

//Configure the request for International or US Sigmets
weatherClient.send(SigmetRequest(type: .international)) { [weak self] response in
    DispatchQueue.main.async {
        switch response {
        case .success(let sigmets):
            //Do something with sigmets
            ...
            
        case .failure(let error):
            // request failed
            let msg = AWCClient.messageIn(error)
            print(msg)
        }
    }
}

Async/Await

AvWeather can also be used in Swift Async/Await concurrency schemes:

(The example shows TAF, but Metar and sigmets can be used as well)

// Instantiate a client
let client = AWCClient()
// Configure the request using 1 or more stations
let request = TAFRequest(forStations: ["ESSA", "ENGM", "GCLP", "LFPG", "KJFK", "KLAX"], mostRecent: true)
do {
    let tafs = try await client.send(request)
    // do something with TAF data
    print(tafs[0].rawText)
} catch {
    // An error was thrown
    print("Error thrown getting tafs: \(AWCClient.messageIn(error))")
}

Package Metadata

Repository: bmonty/AvWeather

Stars: 3

Forks: 3

Open issues: 0

Default branch: master

Primary language: swift

License: MIT

Topics: aviation, aviation-weather

README: README.md