AVWXKit
is a swift client for the METAR/TAF avwx.rest service.
- iOS 11.0+
- Xcode 9.0
You can use CocoaPods to install AVWXKit
by adding it to your Podfile
:
platform :ios, '11.0'
use_frameworks!
pod 'AVWXKit'
Create a Cartfile
that lists the framework and run carthage update
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/AVWXKit.framework
to an iOS project.
github "JanC/AVWXKit"
- Download and drop
AVWXKit.swift
in your project. - Congratulations!
import AVWXKit
// Token from https://account.avwx.rest/
let client = AVWXClient(token: "xxxxx")
// By ICAO
client.fetchMetar(at: "KSBP", options: [.speech, .info]) { result in
switch result {
case .success(let metar):
print("Metar: \(metar.rawReport)")
case .failure(let error):
print("Could not fetch: \(error)")
}
}
// By Coordinates
let coordinates = CLLocationCoordinate2D(latitude: 35.237, longitude: -120.644)
client.fetchMetar(at: coordinates, options: [.info, .speech]) { (result) in
switch result {
case .success(let metar):
print("Metar: \(metar.rawReport)")
case .failure(let error):
print("Could not fetch: \(error)")
}
}
We would love you for the contribution to AVWXKit, check the LICENSE
file for more info.
Jan Chaloupecky – @TexTwil
Distributed under the XYZ license. See LICENSE
for more information.