ParkKit 0.3.0

ParkKit 0.3.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Kilian Koeltzsch.



ParkKit 0.3.0

🚘 ParkKit

This is a wrapper for the API provided by ParkAPI for anything written in Swift. It’s primary purpose is to be used by ParkenDD.

Example

let park = ParkKit() // uses the default server at parkendd.de
// let park = ParkKit(withURL: URL(string: "https://your_server.com")!) // uses your server
park.fetchCities { result in
    guard let response = result.success else { return }
    print(response.cities)
}

// ▿ 13 elements
//   ▿ ParkKit.City
//     - name: "Aarhus"
//     ▿ coordinate: __C.CLLocationCoordinate2D
//       - latitude: 56.153005
//       - longitude: 10.203201
//       ...
park.fetchLots(forCity: "Dresden") { result in
    guard let response = result.success else { return }
    print(response.lots)
}

// ▿ 48 elements
//   ▿ ParkKit.Lot
//     ▿ address: Optional("Wilsdruffer Straße")
//       ...
let startingDate = Date()
let endingDate = startingDate.addingTimeInterval(60 * 60 * 24) // 24 hours later

park.fetchForecast(forLot: "dresdencentrumgalerie", inCity: "Dresden", startingAt: startingDate, endingAt: endingDate) { result in
    guard let response = result.success else { return }
    print(response.forecast)
}

// ▿ 97 elements
//   ▿ (2 elements)
//     - .0: 2017-01-11 00:00:00 +0000
//     - .1: 13
//   ▿ (2 elements)
//     - .0: 2017-01-11 00:15:00 +0000
//     - .1: 12
//   ...

Requirements

Should you be hosting your own version of the ParkAPI server and using this on iOS, you might have to set up an ATS exception if you don’t serve the data via HTTPS.

Using your own server is definitely recommended should you be planning on executing a large amount of requests (e.g. through a multitude of client applications).

Installation

ParkKit is available through Cocoapods, Carthage/Punic and Swift Package Manager, take your pick.

Copypasta for your Podfile:

pod "ParkKit"

Cartfile:

github "kiliankoe/ParkKit"

Package.swift:

.Package(url: "https://github.com/kiliankoe/ParkKit", majorVersion: 0)

Contributors

Kilian Koeltzsch, @kiliankoe

License

ParkKit is available under the MIT license. See the LICENSE file for more info.