/AirQuality

Swift library for basic AQI calculations

Primary LanguageSwift

AirQuality

A utility package for working with air quality measurements.

Currently, supports computing Air Quality Index (AQI) scores given PM2.5 concentrations and US categories.

Usage

let someVal = AirQualityIndex.compute(forPollutant: .PM_25, atConcentration: 37.0)

switch someVal {
case .success(let (aqi, category)):
    print("Your AQI is: \(aqi), which is: \(category.label())")
case .failure(let err):
    switch err {
    case .ConcentrationOutOfRange:
        print("Your AQI is literally off the charts.")
    }
}

TODO

  • More pollutants
  • Probably all kinds of other stuff

Installation

Any way you like, but SPM does work just fine. Note that the branch you want to be following is main.

Relevant references: