Delegate veeryPoiUpdate
func veeryPoiUpdate(_ veery : Veery, poi : Veery.Pois)
Delegate Callback triggered when the backend computed new set of POIs. You should implement VeeryDelegate in your ViewController to use it.
Your are warned only if you are called the requestPoiUpdate and the activate(service : Int) with a service that include Veery.POINT_OF_INTEREST.
This could be used to refresh a Maps.
Parameters
Param name | Type | Usage |
---|---|---|
veery | Veery | none |
poi | Veery.Pois | The whole set of POIs |
Usage / Example
import Foundation import UIKit import Veery class ViewController: UIViewController, VeeryDelegate {// Implement Veery Delegate var renderer: GMUGeometryRenderer! var geoJsonParser: GMUGeoJSONParser! // 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.COLLECT | Veery.POINT_OF_INTEREST) veery.requestPoiUpdate() } ///Tells the delegate that new Poi is available func veeryPoiUpdate(_ veery: Veery, poi: Veery.Pois) { // var i = 0 let pois = poi.toGeoJSONArray() // JSONObject contains circles arround the POI for p in pois { geoJsonParser = GMUGeoJSONParser(data: p) geoJsonParser.parse() renderer = GMUGeometryRenderer(map: mapView, geometries: geoJsonParser.features) renderer.render() let marker = GMSMarker(position: veery.getPois().toArray()[i]) marker.icon = UIImage(named: "pinpoint_purple") marker.map = self.mapView i += 1 } } @IBAction func stopPoi(_ sender: Any) { veery.stopPoiUpdate() } }
user interaction
none
See also
getPois
Get last known list of POIs for that user.
requestPoiUpdate
Request for a callback event when a new set of POIs is computed by the Veery Backend.
stopPoiUpdate
Cancel the call to requestPoiUpdate.
Pois.toArray
Return an array of CLLocationCoordinate2D object.
Pois.toGeoJSONArray
Return an array of GeoJSON (circles around the POIs).
Pois.count
Return the amount of POIs known.
Pois.getWeight
Return the percentage of time spent at the specified POI.
veeryPoiUpdate
Callback triggered every time a new set of POIs is computed by the Veery backend.