MapView

import MapKit

var woeid: WOEID! // data (woeid, city, country, latitude, longitude)

@IBOutlet weak var aMapView: MKMapView!

override func viewDidLoad() {

super.viewDidLoad()

let center = CLLocationCoordinate2D(latitude: woeid.latitude, longitude: woeid.longitude)

let span = MKCoordinateSpan(latitudeDelta: 1, longitudeDelta: 1)

let region = MKCoordinateRegion(center: center, span: span)

self.aMapView.setRegion(region, animated: true)

 

let annotation = MKPointAnnotation()

annotation.coordinate = center

annotation.title = woeid.city

annotation.subtitle = woeid.country

}

Leave a Reply

Your email address will not be published. Required fields are marked *