Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
- // add && view.annotation is ClusterAnnotationView
- if view.annotation is MKUserLocation && view.annotation is ClusterAnnotationView { return }
- let mapAnnotation = view.annotation as! MapMark
- companyNameLabel.text = mapAnnotation.titleName
- companyAddressLabel.text = mapAnnotation.address
- companyPhoneLabel.text = mapAnnotation.phone
- distanseLabel.isHidden = true
- getDirections(from: view)!.calculate { (response, error) in
- self.distanseLabel.isHidden = false
- if let response = response, let route = response.routes.first {
- self.distanseLabel.text = String(format: "%.0f", route.distance / 1609.344) + " mi"
- } else {
- self.distanseLabel.text = "Error getting directions"
- }
- }
- geolocationContainer.setViewHide(view: geolocationContainer, hidden: true)
- bottomView.setViewHide(view: bottomView, hidden: false)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement