ios - put CLLocationCoordinate2D into CLLocation for Swift -
i have method want call when center of map, in cllocationcoordinate2d type.
how put results of cllocationcoordinate2d cllocation?
figured out.
when mapview changes region, lat , lon cllocationcoordinate2d , create cllocation variable lat , lon passed in.
func mapview(mapview: mkmapview!, regiondidchangeanimated animated: bool){ var centre = mapview.centercoordinate 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) }
Comments
Post a Comment