I am trying to set the mapView based on Lat Long but I belive they need to be set as Double and not String?!
if let articlesFromJson = json["articles"] as? [[String:AnyObject]] {
for articleFromJSON in articlesFromJson{
if let title = articleFromJSON["CompanyName"] as? String, let desc = articleFromJSON["SICDescriptions"] as? String, let latitude = articleFromJSON["lat"] as? String, let longitude = articleFromJSON["lon"] as? String {
DispatchQueue.main.async {
self.mainTitle.text = title
self.subMainTitle.text = desc
let lat:CLLocationDegrees = latitude
let lon:CLLocationDegrees = longitude
let deltaLatitude: CLLocationDegrees = 0.01
let deltaLongitude: CLLocationDegrees = 0.01
let span: MKCoordinateSpan = MKCoordinateSpanMake(deltaLatitude, deltaLongitude)
let location: CLLocationCoordinate2D = CLLocationCoordinate2DMake(lat, lon)
let region: MKCoordinateRegion = MKCoordinateRegionMake(location, span)
self.mapView.setRegion(region, animated: true)
}
}
}