Delegate veeryPredictionUpdate
func veeryPredictionUpdate(_ veery : Veery, Predictions : Veery.Predictions)
Delegate Callback triggered when the backend computed a new prediction. You should implement VeeryDelegate in your ViewController to use it.
Your are warned only if you are called the requestPredictionUpdate and the activate(service : Int) with a service that include Veery.PREDICTION.
This could be used to refresh a Maps.
Parameters
Param name | Type | Usage |
---|---|---|
veery | Veery | none |
Predictions | Veery.Predictions | a Predictions object |
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.PREDICTION) veery.requestPredictionUpdate() } func veeryPredictionUpdate(_ veery: Veery, Predictions: Veery.Predictions) { if (Predictions?.isOk())! && ((Predictions?.getProbability())! > 0.5 ) { //....... //....... } } @IBAction func stopPrediction(_ sender: Any) { veery.stopPredictionUpdate() } }
User interaction
none
See also
getNextTrip
Get the next estimated trip for that user.
requestPredictionUpdate
Request for a callback event when a new prediction is computed by the Veery Backend.
stopPredictionUpdate
Cancel the call to requestPredictionUpdate.
Predictions.isOK
Return true if a prediction is in the Cache.
Predictions.isOutdated
Return true if the prediction is outdated (made previously, but now concerns a time in the past)
Predictions.getProbability
Get the level of certainty of the predictive algorithm.
Predictions.getNextDestination
Get the coordinates of the next predicted destination
Predictions.toGeojson
Get the next predicted trip in GeoJSON format.
Predictions.toLocations
Get the next trip in the form of a Location array.
Predictions.toLocationCoordinate2D
Get the next trip in the form of a CLLocationCoordinate2D array.
Predictions.getStartTrip
Get the next start point of the prediction.
Predictions.getStartTime
Get the estimated start time predicted for the next trip.
Predictions.getStartName
Get the name (street name) of the predicted departure place.
Predictions.getArrivalTime
Get the estimated arrival time predicted for the next trip.
Predictions.getArrivalName
Get the name (street name) of the predicted arrival place.
veeryPredictionUpdate
Callback triggered every time a new prediction is computed by the Veery backend.