Swiftpack.co - emma-k-alexandra/WMATA.swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by emma-k-alexandra.
emma-k-alexandra/WMATA.swift v8.3.0
WMATA.swift is a Swift interface to the Washington Metropolitan Area Transit Authority API
⭐️ 12
🕓 4 days ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/emma-k-alexandra/WMATA.swift.git", from: "v8.3.0")

WMATA.swift

WMATA.swift is a Swift interface to the Washington Metropolitan Area Transit Authority API.

Install

Requirements

  • Swift 5.9
  • Xcode 15

Swift Package Manager

dependencies: [
    .package(
        name: "WMATA",
        url: "https://github.com/emma-k-alexandra/WMATA.swift.git", 
        .upToNextMajor(from: "15.0.0")
    )
]

Usage

Standard API

To work with WMATA's Standard API use the WMATA package.

import WMATA

let nextTrains = Rail.NextRails(
    key: YOUR_API_KEY,
    station: .waterfront
)

nextTrains.request { result in 
    switch result {
    case let .success(response):
        print(response.trains)
    case let .failure(error):
        print(error)
    }
}

GTFS Static

To work with GTFS Static data use the MetroGTFS package.

import MetroGTFS

let ashburn = try GTFSStop("STN_N12")

print(ashburn.name) // "ASHBURN METRORAIL STATION"

Documentation

Full documentation is available at https://emma-k-alexandra.github.io/WMATA.swift/documentation/wmata/ or within Xcode.

To view documentation within Xcode, within the menu navigate to Product > Build Documentation. WMATA's documentation will appear under Workspace Documentation within the Developer Documentation window. Navigate to Window > Developer Documentation to open this window.

OS Support

WMATA.swift commits to supporting current minus 2 OS versions.

Currently, WMATA.swift is compatible with macOS 12, iOS 15, tvOS 15, watchOS 8 or higher.

Versioning

WMATA.swift uses semantic versioning. Only major versions will contain breaking changes.

Dependencies

Contact

Feel free to email questions and comments to [email protected]

Contributing

Todo:

  • ☐ Support all GTFS Static data in MetroGTFS
  • ☐ Convert async functions from a Result to return or throw behavior, the dominant async pattern in Swift

Developer

To generate documentation for deploying to Github Pages, run ./docs.sh.

License

WMATA.swift is released under the MIT license. See LICENSE for details.

This package is not distributed by or affiliated with WMATA.

GitHub

link
Stars: 12
Last commit: 4 days ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Related Packages

Release Notes

15.2.0 - MetroGTFS
5 weeks ago

What's Changed

Full Changelog: https://github.com/emma-k-alexandra/WMATA.swift/compare/15.1.0...15.2.0

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics