An iOS app built with SwiftUI that displays real-time alerts for MBTA subway lines in Boston.
- Displays the four main MBTA subway lines: Red, Blue, Orange, and Green
- Fetches live alerts from the MBTA V3 API on tap
- Shows each alert's header and description on a detail page
- Handles the Green Line's four branches (B, C, D, E) automatically
- Xcode 15+
- iOS 17+
- Clone the repository
- Open
mbta project.xcodeprojin Xcode - Run the app on a simulator or device
Note: API key is included in the AlertsRequest file, this should never be done in any actual codebase unless for learning purposes.
| File | Description |
|---|---|
ContentView.swift |
Root view of the app |
SubwayStatus.swift |
Main screen listing the four subway lines |
RowAlertHeaders.swift |
Detail screen showing alerts for a selected line |
AlertsRequest.swift |
API key, data models, and fetchAlerts network call |
This app uses the MBTA V3 API to fetch real-time subway alerts.
The endpoint used is:
GET https://api-v3.mbta.com/alerts?filter[route]=<route>
For the Green Line, all four branches are queried together:
filter[route]=Green-B,Green-C,Green-D,Green-E
AlertsResponse
└── data: [Alert]
└── attributes: AlertAttributes
├── header: String?
└── description: String?