目录
目录README.md

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.

关于
90.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号