Skip to main content

Overview

The Air Quality Index (AQI) card is the centerpiece of the Breeze dashboard, displaying the current air quality using the US EPA Air Quality Index standard. It features an animated circular progress indicator, color-coded status levels, and personalized health recommendations.

Implementation

AQICard Component

The AQI card is implemented in AQICard.swift as a SwiftUI view that observes the dashboard’s view model:
AQICard.swift

Visual Design

The card features:
  1. Circular Progress Indicator
    • Animated progress ring showing AQI value
    • Color changes based on air quality level
    • Scales from 0-500 (US AQI range)
  2. Large AQI Number
    • Bold, rounded font for easy reading
    • Color-coded to match air quality status
    • “US AQI” label below
  3. Status Badge
    • Text description (Good, Moderate, Unhealthy, etc.)
    • Colored circle indicator
    • Detailed health impact description
  4. Health Tips
    • Contextual recommendations based on AQI level
    • Bulleted list format
    • Integrated seamlessly into the card

AQI Status Levels

The app uses the standard US EPA AQI categories, defined in AirQuality.swift:
AirQuality.swift

Complete AQI Scale

  • Color: Green (#34c759)
  • Description: Air quality is pristine! Perfect day for adventures.
  • Health Impact: Air is exceptionally clean, no concerns
  • Color: Green (#34c759)
  • Description: Air quality is great. Breathe easy!
  • Health Impact: Air quality meets health standards, pollutant levels are low
  • Color: Orange (#ff9500)
  • Description: Air quality is acceptable for most people.
  • Health Impact: Unusually sensitive people may experience minor effects
  • Color: Orange-Red (#ff6b00)
  • Description: Sensitive groups should be cautious.
  • Health Impact: May affect children, elderly, and those with respiratory conditions
  • Color: Red (#ff3b30)
  • Description: Everyone may feel the effects now.
  • Health Impact: Air quality is unhealthy for everyone
  • Color: Purple (#af52de)
  • Description: Serious health concerns for everyone.
  • Health Impact: Air pollutants are at dangerous levels
  • Color: Maroon (#8e0000)
  • Description: Emergency conditions. Seriously bad air.
  • Health Impact: Air quality has reached hazardous levels

Color System

Colors are defined in Color+Theme.swift using hex values:
Color+Theme.swift

Health Recommendations

Each AQI level includes tailored health tips displayed in the card:

Sharing Functionality

The AQI card includes a share button using SwiftUI’s ShareLink:

Data Source

Air quality data is fetched from the Open-Meteo Air Quality API via AirQualityService.swift:10-39:
AirQualityService.swift

File Locations

  • Component: BreezeApp/Views/Dashboard/AQICard.swift
  • Model: BreezeApp/Models/AirQuality.swift
  • Service: BreezeApp/Services/AirQualityService.swift
  • Colors: BreezeApp/Extensions/Color+Theme.swift