I am trying to display a map in a Watch app by means of this class:
import WatchKit
class WKMapController: WKInterfaceController {
@IBOutlet var map: WKInterfaceMap!
let mapSpan=0.0001
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
if let location = context as? CLLocation {
NSLog("latitude \(location.coordinate.latitude) longitude \(location.coordinate.longitude)")
let size=MKMapSize(width:mapSpan, height: mapSpan)
let mapRect=MKMapRect(origin: MKMapPoint(x: location.coordinate.latitude-mapSpan/2, y: location.coordinate.longitude-mapSpan/2), size: size)
let regionSpan=MKCoordinateSpan(latitudeDelta: size.width, longitudeDelta: size.height)
let region=MKCoordinateRegionMake(location.coordinate, regionSpan)
map.setRegion(region)
map.setVisibleMapRect(mapRect)
}
}
}
This is description of the MapRegion that should be fine:
Printing description of region:
▿ MKCoordinateRegion
▿ center : CLLocationCoordinate2D
- latitude : 41.7165946960449
- longitude : 12.3110208511353
▿ span : MKCoordinateSpan
- latitudeDelta : 0.0001
- longitudeDelta : 0.0001
Yet just the blank map is displayed. How do I show the real map?