Swiftpack.co - JacobHearst/MetroTransitKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by JacobHearst.
JacobHearst/MetroTransitKit v2.1.1
A Swift wrapper for the Twin Cities Metro Transit API
⭐️ 0
🕓 4 days ago
.package(url: "https://github.com/JacobHearst/MetroTransitKit.git", from: "v2.1.1")

MetroTransitKit

A Swift wrapper for the Twin Cities Metro Transit REST API.

Getting Started

Add MetroTransitKit to your project either through the Xcode UI, or through the process below for Swift Packages

let package = Package(
    // ... Other Package.swift stuff goes here
    dependencies: [
        .package(url: "https://github.com/JacobHearst/MetroTransitKit", from: "1.0.0"), // Add the library to your manifest
    ],
    targets: [
        .target(name: "MyPackage", dependencies: ["MetroTransitKit"]), // Add it to your target's dependencies
    ]
)

Example

import MetroTransitKit

let client = MetroTransitClient()

// Retrieve information about the vehicles driving route 901
client.nexTrip.getVehicles(routeID: "901") { result in
    switch result {
    case .success(let vehicles):
        print(vehicles[0].tripID)
    case .failure(let error):
        print("Received error: \(error)")
    }
}

Network Logging

The MetroTransitClient has a configurable level of network logging with two options: minimal and verbose. Enabling verbose logging will print the HTTP body of each request and response. Minimal logging will log that a request was made (and the URL it's made to) as well as that a response was received.

Contributing

Contributions are always welcome, simply fork this repo, make and test your changes, and then open a pull request. I will try and review it within a reasonable amount of time.

GitHub

link
Stars: 0
Last commit: 4 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v2.0.1 Hotfix
1 week ago

Let this release be a lesson to all those working off of main and not building after making changes

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