目录
目录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)")
}
关于
589.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

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