Directory Overview
App/
Application entry point and root views
Models/
Data structures and business logic
Services/
API communication and data fetching
ViewModels/
State management and business logic
Views/
SwiftUI views and components
Extensions/
Swift extensions and utilities
Resources/
Assets, colors, and resources
Complete File Structure
BreezeApp Project Structure
Directory Details
App/
The application layer containing the entry point and root composition.BreezeApp.swift- Main app entry point with theme configurationContentView.swift- Root view that composes the main UI
Models/
Pure Swift data structures conforming toCodable for API responses.
Key Files:
AirQuality.swift- Air quality data with AQI status calculationCity.swift- City search results from geocoding APIClimateData.swift- Historical temperature data pointsPollenData.swift- Pollen levels for different allergensPollutant.swift- Individual pollutant readings (PM2.5, NO2, etc.)AppearanceMode.swift- Light/dark/system theme preference
Services/
All services are implemented as actors for thread-safe API communication. Key Files:AirQualityService.swift- Fetches current air quality from Open-MeteoClimateService.swift- Retrieves historical climate dataGeocodingService.swift- City search and geocodingPollenService.swift- Pollen forecast data
Each service is a singleton actor (
static let shared) ensuring thread-safe access and preventing data races.ViewModels/
State management layer connecting services to views. Key Files:DashboardViewModel.swift- Main view model managing dashboard state
The ViewModel uses
@MainActor to ensure all UI updates happen on the main thread, and conforms to ObservableObject for SwiftUI reactivity.Views/
SwiftUI views organized by feature and component type. Subdirectories:- Components/ - Reusable UI components (loading states, settings, health tips)
- Dashboard/ - Main dashboard screen and AQI card
- Environmental/ - Climate charts, pollen displays, pollutant grids
- Search/ - City search interface
Extensions/
Swift extensions for additional functionality. Key Files:Color+Theme.swift- Custom color definitions for AQI levels, pollen, and themes
Color Theme Example
Resources/
Asset catalog containing app icons, color sets, and other visual resources. Contents:AccentColor.colorset- App-wide accent colorAppIcon.appiconset- App icon assetsBackground.colorset- Background color for dark/light modes
File Organization Principles
Separation of Concerns
Separation of Concerns
Each layer has a single responsibility:
- Models: Data representation
- Services: API communication
- ViewModels: State management and business logic
- Views: UI presentation
Feature-Based Organization
Feature-Based Organization
Views are organized by feature (Dashboard, Environmental, Search) making it easy to locate related files.
Reusability
Reusability
Common components are extracted into the
Components/ directory and can be used across different screens.Scalability
Scalability
The structure supports growth:
- New features get their own View subdirectories
- New data sources get new Service actors
- Shared models remain in Models/
Navigation Guide
Starting a new feature
- Create models in
Models/for data structures - Create a service actor in
Services/for API calls - Create a view model in
ViewModels/for state management - Create views in appropriate
Views/subdirectory
Extending functionality
Add Swift extensions in
Extensions/ directory (e.g., Date+Formatting.swift).Next Steps
Design Patterns
Learn about MVVM, actors, and architectural patterns
Data Models
Explore the data models in detail