title: How to calculate the distance between my current location and locations populated in a JSON File
body: <p>I am new to Swift, but I am trying to develop my first application. So far I want to calculate the distance between my current location and the nearest shopping malls around me. The locations and the names of the shopping malls are populated in a JSON File. I have created a UISLider between 0 and 50km and when the user select for example 5km, the app has to display all of the shopping malls which are in radius of 5km from the user's location. My JSON file is:</p>
  
  <pre><code> {
     "People": {
              "Person0": {
              "A1": "New York",
              "B1": "ShoppingMall2",
              "C1": "43.0757",
              "D1": "23.6172"
                     },
  
          "Person1": {
              "A1": "London",
              "B1": "ShoppingMall2",
              "C1": "44.0757",
              "D1": "24.6172"
                      },
  "Person2": {
      "A1": "Paris",
      "B1": "ShoppingMall3",
      "C1": "45.0757",
      "D1": "25.6172"
  },
  "Person3": {
      "A1": "Bern",
      "B1": "ShoppingMall4",
      "C1": "41.0757",
      "D1": "21.6172"
  },
  "Person4": {
      "A1": "Sofia",
      "B1": "ShoppingMall4",
      "C1": "46.0757",
      "D1": "26.6172"
  
      }
  }
  }
  </code></pre>
  
  <p>and Code so far is :</p>
  
  <pre><code>import UIKit
  import MapKit
  import CoreLocation
  import SwiftyJSON
  
  class FirstViewController: UIViewController, CLLocationManagerDelegate {
  
  @IBOutlet weak var LabelTest: UILabel!
  @IBOutlet weak var Slider: UISlider!
  @IBOutlet weak var LabelValueSlider: UILabel!
  var MySliderCurrentValue = Double()
  
  var manager = CLLocationManager()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  @IBAction func SliderChange(sender: UISlider) {
      let MySliderCurrentValue: String = String(Int(sender.value))
      LabelValueSlider.text = MySliderCurrentValue
  }
  @IBAction func LocateMe(sender: AnyObject) {
      manager.delegate = self
      manager.desiredAccuracy = kCLLocationAccuracyBest
      manager.requestWhenInUseAuthorization()
      manager.startUpdatingLocation()
  
  }
  func  locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
  
  
      let userlocation: CLLocation = locations[0] as CLLocation
      manager.stopUpdatingLocation()
      let location = CLLocationCoordinate2D(latitude: userlocation.coordinate.latitude, longitude: userlocation.coordinate.longitude)
   //   let span = MKCoordinateSpanMake(0.5, 0.5)
    //  let region = MKCoordinateRegion(center: location, span: span)
  </code></pre>
  
  <p>I have also created a Table View Controller and all of the displayed Shopping Malls will be displayed in the Table View Cells. The main problem is that I do not know how to get the names and the coordinates of the shopping malls from the JSON file and I do not know how to transfer populate them in the Table View Cells. I was wondering maybe I can use prepare for segue, but I am now sure. I would be glad if someone can help me solve these issues.</p>