Repository navigation
1.0.0
π LocomoSwift 1.0.0
A major rewrite bringing GTFS Realtime support, modular imports, configurable data sources with API key authentication, and full DocC documentation.
β¨ New Features
GTFS Realtime Support
- Fetch trip updates, vehicle positions, and service alerts from GTFS-RT protobuf feeds
- Actor-based
RealtimeManagerwith automatic in-memory caching and configurable TTL per source - Protocol-based
RealtimeDataSourcefor testability and future protocol support (SIRI SX) - Typed mappers:
TripUpdateMapper,VehiclePositionMapper,ServiceAlertMapper - Rich models:
RealtimeTripUpdate,RealtimeVehiclePosition,RealtimeServiceAlert, and related enums
DataSource Configuration Struct
- Unified configuration for both GTFS Static and GTFS Realtime: URLs, refresh intervals, cache TTL
- Built-in presets:
.sncfTER,.sncfTGV,.sncfIntercites,.breizhgoTER,.tamMontpellier,.sbb - Fully custom sources via
DataSource(identifier:displayName:...) staticFeedNeedsRefresh(since:)for staleness checkshasStaticFeedandavailableRealtimeFeedTypescomputed properties
API Key Authentication (APIAuthentication)
.queryParam(name:value:)β appends a query parameter to every request URL.header(name:value:)β adds a custom HTTP header to every request.noneβ default, no authenticationwithAuthentication(_:)β create a copy of any preset with your own API key injected- Authentication applied automatically to both static downloads and realtime fetches
Modular Package (3 importable products)
LocomoSwiftGTFSβ GTFS Static only (Feed, DataSource, models)LocomoSwiftRTβ GTFS Realtime only (RealtimeManager, mappers, models) β depends on LocomoSwiftGTFSLocomoSwiftβ Umbrella that re-exports both via@_exported import
Feed + Realtime Integration
Feed(from: DataSource)β load static GTFS from a configured sourceFeed.createRealtimeManager()β convenience to create a manager from a feedFeed.applyRealtimeUpdates(...)β merge realtime data into a static feedFeed.realtimeStatus(for:)β get delay/cancellation status for a trip
π§ Improvements
- Swift 6.2 β Package upgraded to
swift-tools-version: 6.2 - Compiler warnings fixed β removed unnecessary
#availablechecks,deferat end of scope,awaiton sync functions, deprecatedinit(serializedData:)βinit(serializedBytes:) - SOLID refactoring β
DataSource,RealtimeErrorextracted into own files;FeedTyperenamed toRealtimeFeedType;preconditionFailurereplaced withthrows - Error handling β all error messages in English;
LSErrorandRealtimeErrorconform toLocalizedError URLSession.downloadTaskAsyncCompatβ simplified to use native async/await API only (no legacy#availablefallbacks)
π Documentation
- Comprehensive DocC catalog for both
LocomoSwiftGTFSandLocomoSwiftRTGettingStarted.mdβ installation, first feed, data accessDataSourceConfiguration.mdβ presets, custom sources, API key auth, refresh intervalsFetchingRealtimeData.mdβ manager creation, fetching, caching, error handling
- Updated README β reflects 3-module architecture, all presets, auth examples, GTFS support tables
- GitHub Actions CI β
swift-tests.yamlworkflow for automated testing
β οΈ Breaking Changes
- Minimum Swift version: 6.2 (was 5.9)
- Module split:
import LocomoSwiftstill works (umbrella), but internal types moved toLocomoSwiftGTFSandLocomoSwiftRT DataSourcereplaces enum-based configuration: sources are now structs, not enum casesRealtimeManager.fetch*methods: no longer have a defaultsourceparameter β you must explicitly pass aDataSourceFeedTyperenamed toRealtimeFeedType
π¦ Dependencies
| Dependency | Version |
|---|---|
| ZIPFoundation | 0.9.19 |
| swift-protobuf | 1.30.0 |
Full Changelog: 0.0.9...1.0.0