Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiliankoe/dvb
🚆 Query Dresden's public transport system for current bus- and tramstop data in swift
https://github.com/kiliankoe/dvb
dresden dvb public-transportation vvo
Last synced: 2 months ago
JSON representation
🚆 Query Dresden's public transport system for current bus- and tramstop data in swift
- Host: GitHub
- URL: https://github.com/kiliankoe/dvb
- Owner: kiliankoe
- License: mit
- Created: 2016-05-06T18:46:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-04T20:10:15.000Z (over 4 years ago)
- Last Synced: 2024-09-30T23:04:41.624Z (3 months ago)
- Topics: dresden, dvb, public-transportation, vvo
- Language: Swift
- Homepage: https://kiliankoe.github.io/DVB
- Size: 1.5 MB
- Stars: 22
- Watchers: 5
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚆DVB
[![Travis](https://img.shields.io/travis/kiliankoe/DVB.svg)](https://travis-ci.org/kiliankoe/DVB)
[![Version](https://img.shields.io/cocoapods/v/DVB.svg)](http://cocoapods.org/pods/DVB)
[![Platform](https://img.shields.io/cocoapods/p/DVB.svg)](http://cocoapods.org/pods/DVB)
[![Docs](./docs/badge.svg)](https://kiliankoe.github.io/DVB)This is an unofficial Swift package giving you a few options to query Dresden's public transport system for current bus- and tramstop data.
Want something like this for another language, look [no further](https://github.com/kiliankoe/vvo#libraries) 🙂
## Example
Have a look at the [example iOS app](https://github.com/kiliankoe/DVBExample).
## Installation
DVB is available through Cocoapods, Carthage/Punic and Swift Package Manager, whatever floats your boat.
```swift
// Cocoapods
pod 'DVB'// Carthage
github "kiliankoe/DVB"// Swift Package Manager
.package(url: "https://github.com/kiliankoe/DVB", from: "latest_version")
```## Quick Start
Be sure to check the [docs](http://cocoadocs.org/docsets/DVB) for more detailed information on how to use this library, but here are some quick examples for getting started right away.
***Caveat***: Stops are always represented by their ID. You can get a stop's ID via `Stop.find()`. Some of the methods listed below offer convenience overloads, which are listed here since they look nicer. The downside to these is that they have to send of a find request for every stop first resulting in a significant overhead. Should you already have a stop's ID at hand I **strongly** suggest you use that instead.
### Monitor a single stop
Monitor a single stop to see every bus, tram or whatever leaving this stop. The necessary stop id can be found by using the `find()` function.
```swift
// See caveat above
Departure.monitor(stopWithName: "Postplatz") { result in
guard let response = result.success else { return }
print(response.departures)
}
```### Find a specific stop
Say you're looking for "Helmholtzstraße". You can use the following to find a list of matches.
```swift
Stop.find("Helmholtzstraße") { result in
guard let response = result.success else { return }
print(response.stops)
}
```You can also get a list of stops around a given coordinate.
```swift
let coordinate = CLLocationCoordinate2D(latitude: 51.063080, longitude: 13.736835)
Stop.findNear(coordinate) { result in
guard let response = result.success else { return }
print(response.stops)
}
```### Find a route from A to B
Want to go somewhere?
```swift
// See caveat above
Trip.find(from: "Albertplatz", to: "Hauptbahnhof") { result in
guard let response = result.success else { return }
print(response.routes)
}
```### Look up current route changes
Want to see if your favorite lines are currently being re-routed due to construction or some other reason? Check the published list of route changes.
```swift
RouteChange.get { result in
guard let response = result.success else { return }
print(response.lines)
print(response.changes)
}
```### Lines running at a specific stop
Looking to find which lines service a specific stop? There's a func for that.
```swift
// See caveat above
Line.get(forStopName: "Postplatz") { result in
guard let response = result.success else { return }
print(response.lines)
}
```## Authors
Kilian Koeltzsch, [@kiliankoe](https://github.com/kiliankoe)
Max Kattner, [@maxkattner](https://github.com/maxkattner)
## License
DVB is available under the MIT license. See the LICENSE file for more info.
## Terms of Service
Please refer to the [VVO Terms of Service](https://www.vvo-online.de/de/service/widgets/nutzungsbedingungen-1671.cshtml) regarding their widget. Take particular care not to use this library to hammer their servers through too many requests to their graciously-provided API.