SHARE
TWEET

Untitled

a guest Sep 20th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
  2. // add && view.annotation is ClusterAnnotationView
  3.         if view.annotation is MKUserLocation && view.annotation is ClusterAnnotationView  { return }
  4.        
  5.  
  6.         let mapAnnotation = view.annotation as! MapMark
  7.         companyNameLabel.text = mapAnnotation.titleName
  8.         companyAddressLabel.text = mapAnnotation.address
  9.         companyPhoneLabel.text = mapAnnotation.phone
  10.         distanseLabel.isHidden = true
  11.         getDirections(from: view)!.calculate { (response, error) in
  12.             self.distanseLabel.isHidden = false
  13.             if let response = response, let route = response.routes.first {
  14.                 self.distanseLabel.text = String(format: "%.0f", route.distance / 1609.344) + " mi"
  15.             } else {
  16.                 self.distanseLabel.text = "Error getting directions"
  17.             }
  18.         }
  19.         geolocationContainer.setViewHide(view: geolocationContainer, hidden: true)
  20.         bottomView.setViewHide(view: bottomView, hidden: false)
  21.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top