A SwiftUI iOS app for monitoring earthquake data from the USGS API, built with The Composable Architecture (TCA).
- Fetches live earthquake data from the USGS GeoJSON API
- Displays earthquakes with magnitude, location, and time information
- Auto-refresh capabilities with configurable intervals
- List View: Scrollable list of earthquakes with detailed information
- Map View: Interactive map showing earthquake locations with color-coded pins
- Detail View: Comprehensive earthquake details with direct USGS links
- Filter by magnitude range (0.0 - 10.0)
- Filter by time period (past hour, day, week, month, or all time)
- Filter by location with text search
- Clear visual indicators for active filters
- Configurable auto-refresh intervals (1 min to 1 hour)
- Notification threshold settings
- Display preferences (magnitude labels, metric units)
- Toggle minor earthquakes visibility
- Local data caching for offline viewing
- Smart cache validation (5-minute fresh data window)
- Automatic fallback to cached data when network is unavailable
- Clear offline indicators in the UI
QuakeWatch is built using The Composable Architecture (TCA), providing:
- Predictable state management
- Testable business logic
- Modular feature composition
- Comprehensive dependency injection
- Models:
Earthquake
data model with USGS GeoJSON parsing - Clients:
EarthquakeClient
for API communication,CacheManager
for local storage - Features: TCA-based features with State/Action/Reducer patterns
- Views: SwiftUI views with proper state observation
- iOS: 18.5+
- Xcode: 15.0+
- Swift: 5.0+
- Dependencies:
- SwiftUI
- The Composable Architecture
- MapKit
- Swift Testing (for tests)
-
Clone the repository:
git clone https://github.com/yourusername/QuakeWatch.git cd QuakeWatch
-
Open the project in Xcode:
open QuakeWatch/QuakeWatch.xcodeproj
-
Build and run the project using Xcode or the command line:
xcodebuild -project QuakeWatch/QuakeWatch.xcodeproj -scheme QuakeWatch -destination 'platform=iOS Simulator,name=iPhone 16' build
- Xcode: Use Cmd+B to build
- Command Line:
xcodebuild -project QuakeWatch/QuakeWatch.xcodeproj -scheme QuakeWatch -destination 'platform=iOS Simulator,name=iPhone 16' build
- Xcode: Use Cmd+U to run all tests
- Command Line:
xcodebuild test -project QuakeWatch/QuakeWatch.xcodeproj -scheme QuakeWatch -destination 'platform=iOS Simulator,name=iPhone 16'
- The project uses Xcode's built-in analyzer (Product → Analyze)
- Swift Testing framework for modern, expressive tests
- Comprehensive test coverage for all features including offline scenarios
QuakeWatch uses the USGS Earthquake Hazards Program API:
- Endpoint:
https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson
- Format: GeoJSON with earthquake features
- Update Frequency: Real-time (typically updated every 5 minutes)
QuakeWatch/
├── QuakeWatch/
│ ├── QuakeWatchApp.swift # App entry point
│ ├── ContentView.swift # Root view with tab navigation
│ ├── Models/
│ │ └── Earthquake.swift # Core data models
│ ├── Clients/
│ │ ├── EarthquakeClient.swift # API client
│ │ └── CacheManager.swift # Local caching
│ ├── Features/
│ │ ├── EarthquakeListFeature.swift # List feature logic
│ │ ├── EarthquakeDetailFeature.swift # Detail feature logic
│ │ ├── EarthquakeMapFeature.swift # Map feature logic
│ │ ├── SettingsFeature.swift # Settings feature logic
│ │ └── RootFeature.swift # Root navigation logic
│ └── Views/
│ ├── EarthquakeListView.swift # List view UI
│ ├── EarthquakeDetailView.swift # Detail view UI
│ ├── EarthquakeMapView.swift # Map view UI
│ └── SettingsView.swift # Settings view UI
├── QuakeWatchTests/
│ └── QuakeWatchTests.swift # Comprehensive test suite
└── README.md # This file
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- USGS Earthquake Hazards Program for providing real-time earthquake data
- The Composable Architecture for the architectural framework
- Apple's SwiftUI and MapKit frameworks for the user interface
Note: This app is for educational and informational purposes. For official earthquake information and alerts, please refer to your local geological survey or emergency management agency.