Go to file
Yannick Heinrich 784074f28e Update changelog 2022-06-08 12:09:58 +02:00
Sources/StrasbourgParkAPI Add basic docc 2022-06-08 10:55:50 +02:00
Tests Fix test 2021-11-19 15:34:04 +01:00
docs Update jazzy documentation 2022-06-08 09:56:42 +02:00
.gitignore Initial commit 2020-06-30 17:58:21 +02:00
.jazzy.yaml Add documentation 2020-07-01 22:50:16 +02:00
Changelog.md Update changelog 2022-06-08 12:09:58 +02:00
LICENSE Add documentation 2020-07-01 22:50:16 +02:00
Package.resolved Use apple logging facade 2020-07-01 11:26:38 +02:00
Package.swift Add basic docc 2022-06-08 10:55:50 +02:00
README.md Update jazzy documentation 2022-06-08 09:56:42 +02:00

README.md

StrasbourgParkAPI

A simple swift package giving access to the Strasbourg open data for parking (location API and availability API)

Reference can be found here.

Usage

You can interact with the framework using callback closures responses, Combine or async methods

Callback closures

let client = ParkingAPIClient()
client.getLocations { (result) in
    switch result {
        case .success(let locations):
            print("Locations: \(locations)")
        case .failure(let error):
            print("Error during the download: \(error)")
    }
}

Combine

let client = ParkingAPIClient()
client.getLocationsPublisher().sink { result in
    if case .failure(let error) = result {
        print("Error: \(result)")
    }   
} receiveValue: { result in
    print("Response: \(result)")

}

async

let client = ParkingAPIClient()

do {
    let response = try await client.fetchLocations()
    print("Response: \(response)")
} catch let error {
    print("Error: \(error)")
}