Delegate veeryRouteMatch

veeryRouteMatch(_ veery: Veery, locationsHistory: Veery.LocationsHistory)

Delegate triggered when the backend computed new trips. You should implement VeeryDelegate in your ViewController to use it.

Your are warned only if you are called the requestRouteMatch and the activate(service : Int) with Veery.ROUTE_MATCH.

Parameters

Param name Type Usage
veery Veery none
locationsHistory Veery.LocationsHistory a set of routamatched trips

Returns

Void

Usage / Example

import Foundation
import UIKit
import Veery

class ViewController: UIViewController, VeeryDelegate {// Implement Veery Delegate

    // TODO : Inside the principal class (!!not inside a function)
    let veery = Veery()

     override func viewDidLoad() {
        super.viewDidLoad()
        // TODO : Init the delegate
        veery.delegate = self
        // TODO : declare your API Key Secret
        veery.setApiKeySecret("SuPeRScrET12345789GhJ")

        // TODO : Activate the required function levels (user will be requested to accept geolocation)
                    veery.activate(service: Veery.GEOPROFILE)
                    // Requires ios Veery 1.3.3
                    //veery.activate(service:Veery.BACKGROUND_GEOLOC  | Veery.ROUTE_MATCH )


        veery.requestRouteMatch()

    }

    func veeryRouteMatch(_ veery: Veery, locationsHistory: Veery.LocationsHistory) {

        // do whatever you need with the LocationsHistory object
        let geojsons = locationsHistory.toGeoJSON()
        if geojsons.count > 0 {
            for geojson in geojsons {
                // do whatever you need with the GeoJSON object
            }
             let locs = locationsHistory.toArray()

            if locs > 0 {

                let locstart = locs[0]
                let locend   = locs[1]
             }
        }
    }

    @IBAction func stopRouteMatchUpdate(_ sender: Any) {
         veery.stopRouteMatch()
    }

}

User interaction

none

See also

getLocationHistory

Get the historical geolocation data for the mentioned period.

requestRouteMatch

Request Veery to be warned when a new trip was computed by the backend.

stopRouteMatch

Cancel the call to requestRouteMatch.

Locations.toArray

Extract an array of Location objects from a history.

Locations.toGeoJSON

Get a GeoJson representing the history collected. Get a GeoJson representing the history collected.

Locations.toGeoJSONArray

Get an array of GeoJson representing the history collected. Only valid for Veery.HISTORY_ROUTEMATCH.

Locations.getBoundingBox

Get the bounding box of the set of historical data.

veeryRouteMatch

Delegate triggered when the backend computed new trips.