Arrive iOS SDK

Introduction

The Arrive iOS SDK enables developers to find and book parking using the Arrive platform. Contained within the SDK are network requests and responses that can be used to access the Arrive API via native implementations as well as fully fleshed out model objects. Each SDK function provides access to the API without the overhead of building an integration from the ground up.

You will need an API key to use with the SDK. If you do not already have one, send an email to partner-support@arrive.com to request credentials. There will be different API keys that correspond to production and sandbox environments respectively. In order to use each environment, the proper key will need to match.

Setup

Drag Core.framework into your project and embed it into your target via "Frameworks, Libraries, and Embedded Content" section in the project file for your app's target

Initialize an Arrive instance

let apiKey = "<#yourApiKey#>"
let configuration = ApiConfiguration(clientId: apiKey, environment: .sandbox)
self.arriveApi = ArriveApi(with: configuration):

Token Management

before making any api calls, you need to get a public token.

Public Token

arriveApi.authenticationService.getPublicToken {
    response in
    print(response)
}

Authenticated Token

Most api calls require a user authentication. To get a user authentication, use the SDK's AuthenticationService to authenticate a user

arriveApi.authenticationService.authenticateUser(email: "<#username#>", password: "<#password#>") {
    response in
    switch response {
    case .success(let authorization):
        print(authorization)
    case .failure(let error):
        print(error)
    }
}

The authentication token is automatically stored and refreshed after a successful login api call is made. You can check the users logged in state:

arriveApi.authenticationService.isUserAuthenticated

Sample Calls

Get Locations

API reference

let coordinates = Coordinates(lat: 41.879072, lng: -87.6448557)
arriveApi.locationService.getLocations(near: coordinates, within: 0.5) {
    locations in
    ...
    //work with the returned array of locations
    ...
}

Add a Vehicle

API reference

arriveApi.vehicleService.addVehicle(plateNumber: "1B5 2R9",
                                    state: "CA",
                                    nickname: "The pickup truck",
                                    isDefault: true
) {
    vehicle in
    ...
    //work with the returned vehicle
    ...
}

Get Quotes

API reference

To search for parking around a geographic location, create a search (ParkingSearch) and use an instance of the ParkingSearchService from the SDK to execute the search.

Note: Parking searches only require a public token

let search = ParkingSearch.center(Coordinates(lat: 41.879072, lng: -87.6448557))
arriveApi.parkingSearchService.getQuotes(search: search) { (quotes) in
    ...
    //work with the returned array of quotes
    ...
}
Last updated January 10, 2020