put CLLocationCoordinate2D into CLLocation for Swift put CLLocationCoordinate2D into CLLocation for Swift ios ios

put CLLocationCoordinate2D into CLLocation for Swift


Figured it out.

When mapView changes region, get the Lat and Lon from CLLocationCoordinate2D and create a CLLocation variable with the lat and lon passed in.

func mapView(mapView: MKMapView!, regionDidChangeAnimated animated: Bool){    var centre = mapView.centerCoordinate as CLLocationCoordinate2D    var getLat: CLLocationDegrees = centre.latitude    var getLon: CLLocationDegrees = centre.longitude    var getMovedMapCenter: CLLocation =  CLLocation(latitude: getLat, longitude: getLon)    self.lastLocation = getMovedMapCenter    self.fetchCafesAroundLocation(getMovedMapCenter)}