NextBusKit

0.1.6

A simple Swift API wrapper for NextBus transit information
shamanskyh/NextBusKit

What's New

Use Forked Kanna

2019-06-20T06:34:57Z

Use a Forked version of Kanna with more flexible libxml linking for UIKit for Mac.

NextBusKit

A simple API wrapper in Swift for NextBus transit information.

Examples

Initialize a transit Agency:

let agency = Agency(tag: "sf-muni", title: "San Francisco Municipal Railway", regionTitle: "California-Northern")

Get an Agency's routes:

do {
    let nJudah = try agency.routes().filter({ $0.tag == "N" })
} catch {
    fatalError()
}

Get Predictions for a Stop:

do {
    let powellOutbound = Stop(agency: agency, stopTag: "6995", title: "Powell Station Outbound", location: (37.7843, -122.4078199), stopId: "16995")
    let (predictions, _) = try powellOutbound.predictions()
} catch {
    fatalError()
}

Important Notes

Unless otherwise marked, calls should be assumed to be synchronous. It's a good idea to dispatch to a background queue, query routes/stops, then dispatch back to main when you're ready to update your UI.

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 00:32:35 GMT-0900 (Hawaii-Aleutian Daylight Time)