Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. func action(_ gestureRecognizer:UIGestureRecognizer) { // GESTURE RECOGNIZER FUNCTION
  2.  
  3. if gestureRecognizer.state == UIGestureRecognizerState.began {
  4.  
  5. let touchPoint = gestureRecognizer.location(in: self.map)
  6.  
  7. let newCoordinate = self.map.convert(touchPoint, toCoordinateFrom: self.map)
  8.  
  9. let location = CLLocation(latitude: newCoordinate.latitude, longitude: newCoordinate.longitude)
  10.  
  11. CLGeocoder().reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in
  12.  
  13.  
  14. var title = ""
  15.  
  16. if (error == nil) {
  17.  
  18. if let p = placemarks?[0] {
  19.  
  20.  
  21. var subThoroughfare:String = ""
  22. var thoroughfare:String = ""
  23.  
  24. if p.subThoroughfare != nil {
  25.  
  26. subThoroughfare = p.subThoroughfare!
  27.  
  28. }
  29.  
  30. if p.thoroughfare != nil {
  31.  
  32. thoroughfare = p.thoroughfare!
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement