Latest 0.0.9
Homepage https://github.com/immortal79/TPGApi
License GNU v3
Platforms ios 9.0
Dependencies Alamofire, SwiftyJSON

TPG API wrapper to fetch stops and next departures for Geneva’s public transport.

Installation

Using Cocoapods

Add this line in your PodFile

pod 'TPGApi'

Usage

To use the API you must have a valid API key, you can request one here http://www.tpg.ch/web/open-data/donnees-tpg

You have to provide wherever you want in the code like this:

TPGApiKey.key = "your key"

List of all stops in Geneva

Stops have to be loaded at least once, this is done asychronously. Once downloaded the stops are cached on the device.

StopManager.instance.loadStops(completion: {(commercialStops, physicalStops) in

}, force: false)

Next departures for a stop

Get next departures for stop code ‘Gare Cornavin’

DeparturesManager.instance.loadNextDeparturesFor(stopCode: "CVIN", completion: {departures in

})

Steps for a given departure

Get the steps for the line of the departure ‘43844’

DeparturesManager.instance.loadThermometerFor(departureCode: "43844", completion: {steps in

})

Latest podspec

{
    "name": "TPGApi",
    "version": "0.0.9",
    "summary": "A wrapper to fetch Geneva's public transport (TPG) real time informations",
    "description": "You can use this pod to get next departures for a bus stop in Geneva.nYou can also get the list of all the stops in Geneva with their location and connections.",
    "homepage": "https://github.com/immortal79/TPGApi",
    "license": "GNU v3",
    "authors": "Philippe",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/immortal79/TPGApi.git",
        "tag": "0.0.9"
    },
    "source_files": [
        "TPGApi",
        "TPGApi/**/*.{h,m,swift}"
    ],
    "dependencies": {
        "Alamofire": [
            "~> 4.5"
        ],
        "SwiftyJSON": [
            "~> 4.0"
        ]
    }
}

Pin It on Pinterest

Share This